Results 1 to 17 of 17

Thread: Chaining multiple UI with QStatemachine

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2014
    Posts
    10
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Chaining multiple UI with QStatemachine

    thanks?
    Well ... ok I forget i.

    what I don't see the way is : "it receives all pointers,"

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Chaining multiple UI with QStatemachine

    What does your code look right now?

    How and where do you create the instances of these UIs?

    Cheers,
    _

  3. #3
    Join Date
    Feb 2014
    Posts
    10
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Chaining multiple UI with QStatemachine

    To simplify the explanations I'd say I work by validating function parts, that are :
    * using a QStatemachine :

    Qt Code:
    1. QState *s1 = new QState();
    2. QLabel *label1 = new QLabel("Original state ");
    3. QState *s2 = new QState();
    4. QState *s3 = new QState();
    5.  
    6. s1->assignProperty(&button, "text", "Click me"); //Property is assign only when state-machine is started.
    7.  
    8. machine.addState(s1);
    9. machine.addState(s2);
    10. machine.addState(s3);
    11. machine.setInitialState(s1);
    12.  
    13. // Definition de l'enchainement des états
    14. s1->addTransition(&button, SIGNAL(clicked()), s2);
    15. s2->addTransition(&button, SIGNAL(clicked()), s3);
    16. s3->addTransition(&button, SIGNAL(clicked()), s1);
    17.  
    18. // Definition de l'action des états
    19. s1->assignProperty(label1, "text", "Splash screen");
    20. s2->assignProperty(label1, "text", "1 Menu");
    21. s3->assignProperty(label1, "text", "3 Maintenance");
    22.  
    23. machine.start();
    24.  
    25. layout->addWidget(&button);
    26. layout->addWidget(label1);
    To copy to clipboard, switch view to plain text mode 
    ------------------------------------------------------------

    * I aim to use this code into whatever allows me to do what I want to, like any Qtcreator application wizard will generate :

    I use the main (but not sure this is the best idea) :

    Qt Code:
    1. SplashScreen *SScreen = new SplashScreen ();
    2.  
    3. SScreen ->show();
    To copy to clipboard, switch view to plain text mode 
    then in MainWindow I use :
    Qt Code:
    1. void MainWindow::Splash_Timerout()
    2. {
    3. //this->show();
    4. Frm_Warning_Sourceinvalide *Warning_window = new Frm_Warning_Sourceinvalide();
    5. Warning_window->show();
    6. }
    To copy to clipboard, switch view to plain text mode 
    Last edited by anda_skoa; 16th January 2015 at 11:48. Reason: missing [code] tags

  4. #4
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Chaining multiple UI with QStatemachine

    Some options:

    Qt Code:
    1. s1->assignProperty(splashScreen, "visible", true);
    2. s2->assignProperty(warningWindow, "visible", true);
    3.  
    4. // and a transition that triggers s1 -> s2 when the slash closes/times out.
    To copy to clipboard, switch view to plain text mode 

    Qt Code:
    1. connect(s1, SIGNAL(entered()), someReceiver, SLOT(showSplash()));
    2. connect(s2, SIGNAL(entered()), someReceiver, SLOT(showWarning()));
    To copy to clipboard, switch view to plain text mode 

    Cheers,
    _

  5. #5
    Join Date
    Feb 2014
    Posts
    10
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Chaining multiple UI with QStatemachine

    great indeed this is better.
    Then : I still need to update the S1 transition from MainWindow when it's finished after 10s

  6. #6
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Chaining multiple UI with QStatemachine

    That's what I wrote, no?

    Qt Code:
    1. // and a transition that triggers s1 -> s2 when the slash closes/times out.
    To copy to clipboard, switch view to plain text mode 

    Cheers,
    _

  7. #7
    Join Date
    Feb 2014
    Posts
    10
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Chaining multiple UI with QStatemachine

    I meant : by code.

    Thanks

  8. #8
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Chaining multiple UI with QStatemachine

    I don't understand what you mean.

    Of course adding a transition is done by code, how else would you do it?

    Cheers,
    _

  9. #9
    Join Date
    Feb 2014
    Posts
    10
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Chaining multiple UI with QStatemachine

    It's ok.

    I would paraphrase Magrite elsewhere :

    // and a transition that triggers s1 -> s2 when the slash closes/times out.

    "this is not a code"

Similar Threads

  1. QStateMachine set state
    By matteo.ceruti in forum Qt Programming
    Replies: 1
    Last Post: 22nd October 2012, 07:33
  2. Help using QStateMachine
    By d_stranz in forum Qt Programming
    Replies: 6
    Last Post: 10th October 2011, 07:52
  3. Aid on QStateMachine
    By giorgik in forum Qt Programming
    Replies: 1
    Last Post: 27th April 2010, 10:24
  4. QStateMachine
    By piotr.dobrogost in forum Qt Programming
    Replies: 3
    Last Post: 6th December 2009, 08:17
  5. Chaining QIODevice Instances
    By wswartzendruber in forum Newbie
    Replies: 9
    Last Post: 29th July 2009, 20:23

Tags for this Thread

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.