6
我只是試圖設置一個小的QT示例,並且connect語句無法編譯。 從編譯器的錯誤信息是:「爲號召不匹配函數‘的MainWindow ::連接(......’」關於連接的新手QT問題
我究竟做錯了她
謝謝你的幫助
?#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QNetworkAccessManager>
#include <QNetworkReply>
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow {
Q_OBJECT
public:
MainWindow(QWidget *parent = 0);
~MainWindow();
protected:
void changeEvent(QEvent *e);
private:
Ui::MainWindow *ui;
QNetworkAccessManager networkManager;
private slots:
void on_requestButton_clicked();
void on_authenticationRequired(QNetworkReply* reply, QAuthenticator* auth);
void on_finished(QNetworkReply* reply);
};
#endif // MAINWINDOW_H
#include "mainwindow.h"
#include "ui_mainwindow.h"
void MainWindow::on_requestButton_clicked()
{
}
void MainWindow::on_authenticationRequired(QNetworkReply* reply, QAuthenticator* auth)
{
}
void MainWindow::on_finished(QNetworkReply* reply)
{
}
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow), networkManager(this)
{
ui->setupUi(this);
connect(networkManager, SIGNAL(finished(QNetworkReply*)),
this, SLOT(on_finished(QNetworkReply*)));
connect(networkManager,SIGNAL(authenticationRequired(QNetworkReply*, QAuthenticator*)),
this, SLOT(on_authenticationRequired(QNetworkReply*,QAuthenticator*)));
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::changeEvent(QEvent *e)
{
QMainWindow::changeEvent(e);
switch (e->type()) {
case QEvent::LanguageChange:
ui->retranslateUi(this);
break;
default:
break;
}
}
非常感謝。 –