Qt Custom Slot QWebView

291 views Asked by At

I'm fairly new to Qt and I'm trying to work with Signals and Slots and I'm having a bit of trouble creating custom Slots:

public slots:
    void resetUrl(){
        this->load(QUrl("http://www.google.com"));
    }

(Then, in my main.cpp)

#include <QWebView>
#include <QPushButton>

QWebView *web = new QWebView(mainwindow);
QPushButton *button = new QPushButton(mainwindow);

web->load(QUrl("http://www.yahoo.com"));
button->setText("Google");

QObject::connect(button, SIGNAL(clicked()), web, SLOT(resetUrl()));

Thats about all I got, any help is appreciated. What it says when I try to run this is "'class google' has no member named 'load'".

1

There are 1 answers

0
headsvk On

I'm sure your class has no load function, you want web->load(url) NOT this->load(url)