Results 1 to 5 of 5

Thread: Run QML files one after another in sequence

  1. #1
    Join Date
    Jun 2010
    Posts
    97
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Run QML files one after another in sequence

    Hi All,

    My question is on QML. I have lets say 5 .qml files in same directory and each file is having some item and animation attached to that item.

    One.qml
    Two.qml
    Three.qml
    Four.qml
    Five.qml

    Now I want all these 5 .qml files should be executed in sequence i.e. it will start with One.qml and once all its animation is completed it will be removed and Two.qml will start executing its animation and this will continue till Five.qml's execution is completed.
    I want to know how this can be achieved?


    Regards

    Manish

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Run QML files one after another in sequence

    QML files are descriptions of user interfaces and and actions that execute when certain events or signals are received by the elements inside them. They aren't "programs", they don't "execute". They get loaded into memory, parsed, and sit there, waiting for one of the events or signals to occur, and then they react to it.

    Animations run when their "running" property is set to "true" or their "start()" method is invoked. One way to cause a series of animations to run in sequence is to connect animation 2 with the "onStopped" slot of animation 1, something like this:

    Qt Code:
    1. // One.qml:
    2.  
    3. Animation {
    4. id: one
    5.  
    6. onStopped: two.running = true
    7. }
    8.  
    9.  
    10. // Two.qml
    11. Animation {
    12. id: two
    13.  
    14. onStopped: three.running = true
    15. }
    16.  
    17. // etc.
    To copy to clipboard, switch view to plain text mode 

    You could also use the Animation::start() method. Setting the "running" property to "true" is equivalent to calling start().

    The code above isn't valid QML - you can't use the Animation object stand-alone; you have to use one of the derived types (NumberAnimation, PropertyAnimation, etc.)

  3. #3
    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: Run QML files one after another in sequence

    One approach for a sequence of scenes would be to have a main file that uses a loader to load the invidual scenes.
    Each scene would also emit a signal once its last animation is done.
    The main file would connect to the loader item's signal and change the loader source to the next file in the sequence.

    Cheers,
    _

  4. #4
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Run QML files one after another in sequence

    Quote Originally Posted by anda_skoa View Post
    One approach for a sequence of scenes would be to have a main file that uses a loader to load the invidual scenes.
    Each scene would also emit a signal once its last animation is done.
    The main file would connect to the loader item's signal and change the loader source to the next file in the sequence.
    Yes, I thought of this as another way to do the same thing. In this case, the main file needs to know about all of the items in the sequence; in my case, each item only needs to know what comes next. Either solution will do what is needed.

  5. #5
    Join Date
    Jun 2010
    Posts
    97
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Run QML files one after another in sequence

    Thanks d_stranz and anda_skoa.

    Yes, I know that these qml files aren't executable programs but just want to run one after another as a sequence of event. Both the methods stands valid for me as I will be knowing which are qml files are there and which to run next. Both the methods are providing me the solution which I am looking for.

    Thanks a lot for quick help.


    Regards

    Manish

Similar Threads

  1. Image sequence Questions...
    By Deep Thought in forum Qt Programming
    Replies: 5
    Last Post: 12th February 2016, 10:23
  2. every possible sequence
    By timmu in forum Qt Programming
    Replies: 3
    Last Post: 10th August 2012, 13:36
  3. show and resize sequence
    By Windsoarer in forum Qt Programming
    Replies: 2
    Last Post: 20th May 2012, 20:36
  4. Sequence images player
    By hhe in forum Qt Programming
    Replies: 1
    Last Post: 15th May 2010, 08:13
  5. Frame sequence
    By bmn in forum Qt Programming
    Replies: 7
    Last Post: 22nd May 2008, 21:57

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.