Qt 6.11 is out! See what's new in the release
blog
How display Time (hh:mm:ss) not statically?
General and Desktop
8
Posts
3
Posters
12.7k
Views
1
Watching
-
Hi all,
I'm studing QT only for fun..
i would like to build a little application with a label wich shows the exact time that flows like this:I writed:
@
ui->label->setText(QTime::currentTime().toString("h:mm:ss "));
@but I get only the time instant, and the second does not run ..
the time is still!how can I correctly display the time? like this : http://time.is/it/???
thanks for help
-
I don't think the text of a QLabel is meant to automatically change by itself. The QTime::toString gives the QString corrsponding to the input QTime value. I guess if you want a QLabel that changes, you'll have to use signal/slots to rewrite your QLabel every second (i.e. every time the QTime changes).