PDA

View Full Version : error with a signal - slot



mmm286
10th November 2009, 16:46
Hi,

I'm using QWebView with the signal LoadFinished but I have the error:



/home/david/proyectos qt/networkacessmanager/red/mainwindow.cpp:17: error: no matching function for call to ‘MainWindow::connect(QWebView&, const char*, MainWindow* const, const char*)’

The code is:

Mainwindow.cpp




MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent), ui(new Ui::MainWindow)
{
ui->setupUi(this);
QNetworkAccessManager *manager = new QNetworkAccessManager(this);
manager->get(QNetworkRequest(QUrl("http://qt.nokia.com")));
QWebView webview;
webview.setUrl(QUrl("http://www.google.com"));

connect(webview,SIGNAL(loadFinished(bool)), this, SLOT(salida(bool)));
.......
}

void MainWindow::salida(bool ok)
{
ok = false;

}



mainwindow.h



class MainWindow : public QMainWindow
{
....
....
private slots:

void salida(bool ok);



Any help?
Many thanks!

Lykurg
10th November 2009, 17:41
Use the Q_OBJECT macro in your class definition!

EDIT: and your QWebView should be created on the heap, because it will be deleted after the constructor...