View Full Version : countdown timer
arninio123
15th February 2012, 09:27
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.
Lykurg
15th February 2012, 10:01
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!
DaneAU
15th February 2012, 13:35
Have a look into QTimer
class MyClass : public QObject {
Q_OBJECT
public:
MyClass();
public slots:
void myTimerHandler();
private:
QTimer * timer;
qint32 counter;
};
// .. cont
MyClass::MyClass()
{
counter = 0;
timer = new QTimer(this);
connect(timer,SIGNAL(timeout()), this ,SLOT(myTimerHandler()));
timer->start(1000); // 100 nanoseconds or 1 second interval
}
void MyClass::myTimerHandler()
{
counter++;
qDebug() << QString("Time: %1 seconds").arg(counter);
}
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.