Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Unsolved Sliding objects animation

    QML and Qt Quick
    animation states transition
    1
    2
    826
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • M
      Mark81 last edited by

      Hello,
      let's say I have several QML objects and I want to show them one at time. When a new one is requested the current one should exit and the new one should enter.
      I'm not going to rely on ready-to-use QML Types like StackView or SwipeView because I might need to customize a lot the behavior and the animation.

      The main point is understand how to handle the reposition of the items.
      Sample behavior:

      1. at first, item A is shown at (0, 0), all other items are placed at (X, 0) i.e. off-screen on the right edge
      2. when the item C is requested I start an animation to move A off-screen on the left side and let B to enter from right.
      3. now if another item is requested (A, B, etc...) the same should happen. So C exits from the left and the new one enters from the right

      The problem is I need to reposition each "exited" items off-screen on the right side in order to be ready for another request.
      I could do this using a function that cycle all items and if they aren't the current one, it will move them to the idle position.
      But I don't know how to programmatically reference a QML Object because the id is not a string.

      M 1 Reply Last reply Reply Quote 0
      • M
        Mark81 @Mark81 last edited by

        @Mark81 Well, I've just discovered the objectName property. Not so straight (it requires cycling among all children) but it works.

        1 Reply Last reply Reply Quote 0
        • First post
          Last post