Results 1 to 4 of 4

Thread: Timer for application

  1. #1
    Join Date
    Dec 2007
    Posts
    28
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    18

    Default Timer for application

    Hi

    I have a little problem, i want to create timer for my appliaction witch ll show how long user is using a program. My first idea was currentTime - startingProgramTime, but QTime dosent have operator-... Do u have any ideas how can i create it?

    Best Regards

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,376
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    4
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: Timer for application

    Take a look at QTime::elapsed().

  3. The following user says thank you to wysota for this useful post:

    Zergi (26th December 2007)

  4. #3
    Join Date
    Dec 2007
    Posts
    28
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    18

    Default Re: Timer for application

    I have 1 more question... Its any function wich is changing int form to time? Because QTime::elapsed() returns int... Do i have to write algoritmic wich ll change ms to s and later s to min?

    Best Regards

  5. #4
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    8
    Thanked 541 Times in 521 Posts

    Default Re: Timer for application

    Well, not really. You can also construct a null QTime(with the default constructor) and use QTime::addMSecs(startTime.elapsed()), and then convert this to string.

  6. The following user says thank you to marcel for this useful post:

    Zergi (26th December 2007)

Similar Threads

  1. Problem about timer in multithread programs
    By vql in forum General Programming
    Replies: 4
    Last Post: 17th October 2007, 16:00
  2. Thread(s) and socket, timer slots
    By stephdev1965 in forum Qt Programming
    Replies: 1
    Last Post: 8th November 2006, 15:04
  3. How and when to repaint a widget ?
    By yellowmat in forum Newbie
    Replies: 7
    Last Post: 3rd April 2006, 17:36
  4. Timer call
    By mahe2310 in forum Qt Programming
    Replies: 1
    Last Post: 28th March 2006, 09:57
  5. Timer not timing out?
    By Mariane in forum Newbie
    Replies: 5
    Last Post: 2nd March 2006, 22:30

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.