Results 1 to 3 of 3

Thread: QTimer class and timeout() signal and slot not connecting

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Sep 2009
    Posts
    60
    Thanks
    6
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default QTimer class and timeout() signal and slot not connecting

    I have a widget:
    Qt Code:
    1. //foo.h
    2. #include <QTimer>
    3. ...
    4.  
    5. class foo : public QWidget
    6. {
    7. ...
    8. private slots:
    9. void on_timer_timeout();
    10. ...
    11. private:
    12. QTimer *timer;
    13. ...
    14. }
    To copy to clipboard, switch view to plain text mode 
    and
    Qt Code:
    1. //foo.cpp
    2. #include "foo.h"
    3. foo::foo(QWidget *parent)
    4. : QWidget(parent)
    5. {
    6. ...
    7. timer = new QTimer(this);
    8. timer->start(5);
    9. ...
    10. }
    11.  
    12. void foo::on_timer_timeout()
    13. {
    14. //do stuff
    15. }
    To copy to clipboard, switch view to plain text mode 
    When I run the program that creates the widget foo, I get the error:
    QMetaObject::connectSlotsByName: No matching signal for on_timer_timeout().

    What is the problem?
    Last edited by di_zou; 8th September 2009 at 21:17.

Similar Threads

  1. QTimer in QThread doesn't start or timeout
    By Boron in forum Qt Programming
    Replies: 9
    Last Post: 21st October 2011, 13:51
  2. Replies: 3
    Last Post: 15th April 2007, 19:16
  3. QTimer problem ... it runs but never triggs
    By yellowmat in forum Newbie
    Replies: 4
    Last Post: 4th July 2006, 12:54

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
  •  
Qt is a trademark of The Qt Company.