Results 1 to 2 of 2

Thread: error with a signal - slot

  1. #1
    Join Date
    Aug 2009
    Posts
    38
    Thanks
    3

    Default error with a signal - slot

    Hi,

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

    Qt Code:
    1. /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*)’
    To copy to clipboard, switch view to plain text mode 

    The code is:

    Mainwindow.cpp
    Qt Code:
    1. MainWindow::MainWindow(QWidget *parent)
    2. : QMainWindow(parent), ui(new Ui::MainWindow)
    3. {
    4. ui->setupUi(this);
    5. QNetworkAccessManager *manager = new QNetworkAccessManager(this);
    6. manager->get(QNetworkRequest(QUrl("http://qt.nokia.com")));
    7. QWebView webview;
    8. webview.setUrl(QUrl("http://www.google.com"));
    9.  
    10. connect(webview,SIGNAL(loadFinished(bool)), this, SLOT(salida(bool)));
    11. .......
    12. }
    13.  
    14. void MainWindow::salida(bool ok)
    15. {
    16. ok = false;
    17.  
    18. }
    To copy to clipboard, switch view to plain text mode 

    mainwindow.h

    Qt Code:
    1. class MainWindow : public QMainWindow
    2. {
    3. ....
    4. ....
    5. private slots:
    6.  
    7. void salida(bool ok);
    To copy to clipboard, switch view to plain text mode 

    Any help?
    Many thanks!

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: error with a signal - slot

    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...

Similar Threads

  1. Replies: 8
    Last Post: 27th August 2009, 15:51
  2. pthread instead QThread
    By brevleq in forum Qt Programming
    Replies: 8
    Last Post: 23rd December 2008, 08:16
  3. Connection of custon signals/slots
    By brevleq in forum Qt Programming
    Replies: 2
    Last Post: 23rd December 2008, 08:04
  4. Replies: 12
    Last Post: 18th September 2008, 16:04
  5. signal slot conection using a string, not a SLOT
    By rianquinn in forum Qt Programming
    Replies: 6
    Last Post: 5th February 2006, 19:52

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.