anh5kor
14th October 2014, 15:29
Hello,
I want to add a time on my design which starts with formate 00:00:00 and my number should keep on increasing every seconds.
I tried to add the code
showtime()
{
QTime time =QTime::currentTime();
QString time_text = time.toString("hh:mm:ss");
ui.clock->setText(time_text);
}
constructor()
{
QTimer *timer = new QTimer(this);
connect(timer,SIGNAL(timeout()),this,SLOT(showtime ()));
timer->start();
}
but I am getting my system time.
I want it should start from zero and keep on increasing every second.
Please let me know some solution.
I want to add a time on my design which starts with formate 00:00:00 and my number should keep on increasing every seconds.
I tried to add the code
showtime()
{
QTime time =QTime::currentTime();
QString time_text = time.toString("hh:mm:ss");
ui.clock->setText(time_text);
}
constructor()
{
QTimer *timer = new QTimer(this);
connect(timer,SIGNAL(timeout()),this,SLOT(showtime ()));
timer->start();
}
but I am getting my system time.
I want it should start from zero and keep on increasing every second.
Please let me know some solution.