See documentation of QTimer. Here's an example:
timer->setInterval(1000);
connect(timer, SIGNAL(timeout()), this, SLOT(updateTime()));
connect(button, SIGNAL(clicked()), timer, SLOT(start()));
void MyWindow::updateTime()
{
timeEdit
->setTime
(QTime::currentTime());
}
QTimer *timer = new QTimer(this);
timer->setInterval(1000);
connect(timer, SIGNAL(timeout()), this, SLOT(updateTime()));
connect(button, SIGNAL(clicked()), timer, SLOT(start()));
void MyWindow::updateTime()
{
timeEdit->setTime(QTime::currentTime());
}
To copy to clipboard, switch view to plain text mode
Bookmarks