Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. Time in QT gui
Qt 6.11 is out! See what's new in the release blog

Time in QT gui

Scheduled Pinned Locked Moved Unsolved Qt Creator and other tools
4 Posts 3 Posters 487 Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    Pariposh
    wrote on last edited by
    #1

    can anyone tell me how to display current running time on the Gui as a lable or any other widget...?

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      QTime
      QTimer
      QLabel

      Use a one second QTimer to trigger a slot into which you grab the current time using QTime and show the string representation of it on a QLabel.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • M Offline
        M Offline
        mchinand
        wrote on last edited by
        #3

        See the digital clock example on how to use a QTimer to display the time. You could sub-class QLabel instead of QLCDNumber as in the example and use its setText() method to display the current time when the slot is called.

        1 Reply Last reply
        1
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          In addition to @mchinand, there's also the Analog Clock example for a less digital looking UI.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved