Results 1 to 3 of 3

Thread: countdown timer

  1. #1
    Join Date
    Feb 2012
    Posts
    19
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default countdown timer

    hello

    Can somebody sent me a code for a countdown timer i want to make a scoreboard.
    counting down in minutes and seconds.
    whit a start reset and pause button.

  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: countdown timer

    Quote Originally Posted by arninio123 View Post
    Can somebody sent me a code for a countdown timer
    No. In this forum we assist and help people and don't do their work!

  3. The following user says thank you to Lykurg for this useful post:

    arninio123 (16th February 2012)

  4. #3
    Join Date
    May 2011
    Posts
    11
    Thanks
    2
    Qt products
    Qt4 Qt Jambi
    Platforms
    Unix/X11 Windows Symbian S60 Maemo/MeeGo
    Wiki edits
    1

    Default Re: countdown timer

    Have a look into QTimer
    Qt Code:
    1. class MyClass : public QObject {
    2. Q_OBJECT
    3. public:
    4. MyClass();
    5.  
    6. public slots:
    7. void myTimerHandler();
    8.  
    9. private:
    10. QTimer * timer;
    11. qint32 counter;
    12. };
    13. // .. cont
    14.  
    15. MyClass::MyClass()
    16. {
    17. counter = 0;
    18. timer = new QTimer(this);
    19. connect(timer,SIGNAL(timeout()), this ,SLOT(myTimerHandler()));
    20. timer->start(1000); // 100 nanoseconds or 1 second interval
    21. }
    22.  
    23. void MyClass::myTimerHandler()
    24. {
    25. counter++;
    26. qDebug() << QString("Time: %1 seconds").arg(counter);
    27. }
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. Help!! countdown timer
    By arninio123 in forum Newbie
    Replies: 2
    Last Post: 8th February 2012, 15:17
  2. timer problem(timer does not work)
    By masuk in forum Newbie
    Replies: 6
    Last Post: 14th February 2011, 05:00
  3. Accuracy of the timer in Qt
    By Fastman in forum Qt Programming
    Replies: 5
    Last Post: 21st July 2009, 21:52
  4. implemet a timer
    By adamatic in forum Qt Programming
    Replies: 12
    Last Post: 17th February 2009, 07:31
  5. a countdown widget
    By anarsynd in forum Newbie
    Replies: 12
    Last Post: 20th November 2007, 14:51

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.