Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Time and Date



  • Hi all

    another seemingly simple problem but I have been reading around for ages and I cant seem to find a solution, currently trying (emphasis on word trying ) to build a touch screen gui , its my first attempt at anything on qt.

    I basically just want to add the current time and date to mainwindow.ui

    I am completely stuck i have read all sorts and i have confused myself

    thanks

    danny


  • Lifetime Qt Champion

    Hi,

    Do you mean in the status bar for example ?

    In any case, you can use a QTimer triggered every second and QTime to get the current time to show on the status bar.


  • Lifetime Qt Champion

    Hi @DanJenk,

    not exactly what you want, but I have a very similar example on my github: StopWatch.

    Should be easy to transform to show the current date / time (hint: you can get that with QDateTime::currentDateTime().

    Regards


Log in to reply