Results 1 to 4 of 4

Thread: QTimer problem

  1. #1
    Join Date
    Jun 2007
    Location
    India/Bangalore
    Posts
    156
    Thanks
    26
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default QTimer problem

    hi,

    I am using QTimer in my code, i created QTimer object and connectecd timeout signal to one slot. I am giving 5 millisec timeout for timer. but that slot is not calling after timeout.
    Any specific way to use the timer?

    My code is:

    Qt Code:
    1. m_pTimer = new QTimer();
    2. connect(m_pTimer, SIGNAL(timeout()), this, SLOT(TimerNotification()));
    To copy to clipboard, switch view to plain text mode 
    in buttonClick function:
    Qt Code:
    1. m_pTimer->start(2000);
    To copy to clipboard, switch view to plain text mode 
    Last edited by jpn; 1st September 2008 at 06:17. Reason: missing [code] tags
    Thanks,
    Rajesh.S

  2. #2

    Default Re: QTimer problem

    When you call connect , they will return a bool value, you can see the value is "true"
    and , does your TimerNotification() is defined under
    public slots
    or
    private slots

  3. #3
    Join Date
    Jun 2007
    Location
    India/Bangalore
    Posts
    156
    Thanks
    26
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QTimer problem

    connect returning true, TimerNotification() function is private slot. And in command window "QObject::startTimer: QTimer can only be used with threads started with QThread:" this message is printing. i am not using any QThread in my code.
    Thanks,
    Rajesh.S

  4. #4
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,518 Times in 1,388 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: QTimer problem

    Probably either the required Q(Core)Application instance is missing or you're using non-Qt threading mechanisms.
    J-P Nurmi

Similar Threads

  1. Replies: 8
    Last Post: 27th March 2013, 11:51
  2. Extending QTimer()
    By rishid in forum Qt Programming
    Replies: 3
    Last Post: 7th August 2009, 01:59
  3. QThread/QObject and QTimer
    By swiety in forum Qt Programming
    Replies: 2
    Last Post: 25th January 2008, 08:37
  4. Replies: 5
    Last Post: 6th March 2007, 05:34
  5. 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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.