Results 1 to 6 of 6

Thread: QStataMachine: transition guards

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jun 2011
    Posts
    25
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default QStataMachine: transition guards

    Hi all,

    I basically have a QStateMachine with 3 states: A, B and C.
    I want to model state machine transitions like:
    1) A -> B [event e1]
    2) A -> C [event e1]
    3) B -> C [event e2]

    And I want to add exclusive guard on transitions #1 and #2 like:
    1) if (myModel.v)
    3) if (!myModel.v)

    The final goal is to manage locking of access from A to C by inserting password:
    when I am in A and fire e1 (for example by clicking on a button in my GUI):
    - if "myModel.v" is not set (i.e. C is still locked by password) go to state B (to insert password)
    - if "myModel.v" is set (that is C was unlocked) go to state C.

    What is the best way to add these guards on transitions?
    Can you give me a small example?

    Thank you,

    Nicola
    Last edited by nick85; 26th September 2013 at 13:24.

Similar Threads

  1. Replies: 3
    Last Post: 2nd September 2013, 18:01
  2. How to know the signal which caused a qstate transition
    By ClintEastwood in forum Qt Programming
    Replies: 6
    Last Post: 24th April 2013, 15:27
  3. Replies: 2
    Last Post: 16th November 2010, 06:11
  4. Transition from QMainWindow to QWidget
    By Sabre Runner in forum Newbie
    Replies: 5
    Last Post: 12th October 2010, 16:05
  5. Qt3 to Qt4 transition, setWindowIcon() problems
    By watashi16 in forum Qt Programming
    Replies: 5
    Last Post: 13th December 2007, 20:18

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.