Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Sliding objects animation

Sliding objects animation

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
animationstatestransition
2 Posts 1 Posters 1.0k Views
  • 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 Offline
    M Offline
    Mark81
    wrote on 18 Jul 2016, 12:04 last edited by
    #1

    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 18 Jul 2016, 12:27
    0
    • M Mark81
      18 Jul 2016, 12:04

      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 Offline
      M Offline
      Mark81
      wrote on 18 Jul 2016, 12:27 last edited by
      #2

      @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
      0

      2/2

      18 Jul 2016, 12:27

      • Login

      • Login or register to search.
      2 out of 2
      • First post
        2/2
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved