I’m writing an application with QWebView class and I want to catch when it redirectes to the other url address using urlChanged(const QUrl&) signal, but at run time I get this
Object::connect: No such signal QWebView::urlChanged(url)
here is my code
#include <QString>
#include "test.h"
#include <QUrl>
#include <QWebView>
#include <stdio.h>
QFapp::QFapp(QWidget* parent):QWidget(parent)
{
QWebView*view = new QWebView;
QUrl url("http://google.com");
view->load(url);
view->show();
connect(view,SIGNAL(urlChanged(url)),this,SLOT(GetToken()));
}
void QFapp::GetToken()
{
printf("Signal is emited");
}
and this is the header file
#include <QWidget>
#include <QString>
#include <QUrl>
#include <QWebView>
class QFapp: public QWidget
{
Q_OBJECT
public:
QFapp(QWidget* parent = 0);
public slots:
void GetToken();
private:
QWebView* view;
QUrl url;
};
and there are no compile time warnings.
I don’t understand what am I doing wrong. This is my first experience with Qt (not a school assignment ) so any hint will be appreciated.
The problem is with this line of code:
the SIGNAL macro takes in a function signature, and is not a function call. It should look like this:
This signal will emit whenever the url of the WebView changes, and pass you the url that it changed to.