Results 1 to 3 of 3

Thread: QTimer or something else

  1. #1
    Join Date
    Jul 2010
    Posts
    30
    Thanks
    10
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Question QTimer or something else

    Hi !

    I am writing a program with Qt that runs in background and at some specific time it should turn a camera with a unique id on.
    We have four cameras so maybe we would have these rules( suppose system current time is 8:00 )

    at 12:00 turn on camera 0
    at 13:22 turn on camera 2 for 3 mins
    at...

    Is it good idea to use QTimer with a big interval? Do you have a better idea?
    Thanks
    Impossible = I'mpossible

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: QTimer or something else

    QTimer is a good choice. You can also use QObject::timerEvent() directly if you like. In General I would use a timer with a shorter range and just do nothing if it isn't the time yet. This way you get a more accurate execution time.

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

    .:saeed:. (14th December 2011)

  4. #3
    Join Date
    Mar 2008
    Location
    Kraków, Poland
    Posts
    1,525
    Thanked 279 Times in 274 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QTimer or something else

    I think the best solution is a queue of tasks and QTimer with a period, for example, 1 minute. In the slot, check to see if the queue we have some work to do in a given time and execute them.

  5. The following user says thank you to Lesiok for this useful post:

    .:saeed:. (15th December 2011)

Similar Threads

  1. Use a QTimer in a Qt-non-GUI app.
    By hakermania in forum Newbie
    Replies: 11
    Last Post: 29th August 2010, 11:36
  2. QTimer
    By link7 in forum Newbie
    Replies: 4
    Last Post: 2nd June 2009, 09:35
  3. QTimer
    By dragon in forum Qt Programming
    Replies: 18
    Last Post: 16th November 2008, 15:15
  4. QTimer
    By Ahmad in forum Qt Programming
    Replies: 1
    Last Post: 22nd October 2007, 19:26
  5. QTimer
    By nirup in forum Qt Programming
    Replies: 1
    Last Post: 29th May 2007, 15:13

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.