Results 1 to 2 of 2

Thread: Perform a cyclic task in a QState

  1. #1
    Join Date
    Jan 2008
    Location
    Germany
    Posts
    80
    Thanks
    6
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Perform a cyclic task in a QState

    Hi,

    I would like to know if there is a possibility to perform a cyclic task in a QState, or if it is not advised to so such a thing.
    In my case I would like to detect the presence of a device connected to my PC before using it.
    So I was thinking using a QStateMachine with something like:

    QState *s1_detectDriver = new QState();
    QState *s2_detectDevice = new QState();
    QState *s3_connectToDevice = new QState();

    In my state s2_detectDevice I would like to use the driver to find out if the device is connected. If not I have to ask again after a certain time, if not I have to ask again after a certain time and so on... once the device is connected I can connect to it.

    Does it make sense to use QStateMachine for such kind of thing ?

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

    Default Re: Perform a cyclic task in a QState

    I would consider using a state machine in such situation as an overkill. Unless it's part of some bigger process (like changing properties of some objects upon state changes, etc.).

Similar Threads

  1. Replies: 4
    Last Post: 25th March 2010, 10:32
  2. Replies: 12
    Last Post: 22nd March 2010, 08:59
  3. Task Window in Qt
    By doberkofler in forum Qt Programming
    Replies: 0
    Last Post: 4th November 2009, 08:00
  4. rotate in QState
    By estel in forum Qt Programming
    Replies: 0
    Last Post: 21st October 2009, 12:39
  5. QListBox with QListBoxItems cyclic List
    By codebehind in forum Newbie
    Replies: 3
    Last Post: 24th June 2007, 19:47

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.