Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to design a class like QTimer ?
QtWS25 Last Chance

How to design a class like QTimer ?

Scheduled Pinned Locked Moved General and Desktop
4 Posts 3 Posters 1.9k Views
  • 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.
  • M Offline
    M Offline
    master huang
    wrote on last edited by
    #1

    As the question of title ,now I want to design a class ,the class has the effent such as the class of QTimer in Qt, user can use the class to decide when to start and when to stop ,and decide how long has passed between start and end ?

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mlong
      wrote on last edited by
      #2

      Why not just use QTimer or QElapsedTimer?

      Software Engineer
      My views and opinions do not necessarily reflect those of anyone -- living or dead, real or fictional -- in this universe or any other similar multiverse node. Void where prohibited. Your mileage may vary. Caveat emptor.

      1 Reply Last reply
      0
      • Y Offline
        Y Offline
        yogesh
        wrote on last edited by
        #3

        If I am getting your question right. I think you need to have a timer inside you class. That timer will be keep running infinite with a configurable interval. After each tick it will observe a start/end command from its user class. So your new class will be observing the commands from user class.

        In other way, you can have a start timer (literally) in your new class. EXPLAINATION:
        Your new class will accept a DATETIME in constructor and the internal timer of your new class will keep obsering that the current date time = DATETIME supplied. If yes then it will invoke some functionality.

        ,, I hope its helpful, huff huff

        1 Reply Last reply
        0
        • M Offline
          M Offline
          master huang
          wrote on last edited by
          #4

          [quote author="Yogesh" date="1331881509"]If I am getting your question right. I think you need to have a timer inside you class. That timer will be keep running infinite with a configurable interval. After each tick it will observe a start/end command from its user class. So your new class will be observing the commands from user class.

          In other way, you can have a start timer (literally) in your new class. EXPLAINATION:
          Your new class will accept a DATETIME in constructor and the internal timer of your new class will keep obsering that the current date time = DATETIME supplied. If yes then it will invoke some functionality.

          ,, I hope its helpful, huff huff[/quote]

          It‘s kind of you,you see,you help me a lot~~

          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