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. Animating delegate Rectangle - need to stop animation - but need to reset state
Forum Updated to NodeBB v4.3 + New Features

Animating delegate Rectangle - need to stop animation - but need to reset state

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
2 Posts 1 Posters 589 Views 1 Watching
  • 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.
  • V Offline
    V Offline
    VRHans
    wrote on last edited by
    #1

    I have a list view with an associated model, the delegate for this list view create a rectangle with a thick border.

    When someone clicks on an item (instance of the delegate) I set a flag on the model element to indicate that it is 'selected.'

    When the user clicks a different item or clicks the same item again, the selected item is unselected and the new item is flagged as selected.

    It's easy to put an animation on the delegate rect that start running the animation like this

    running: selected

    That works great for starting and stopping the animation, but the problem is that when the animation stops I need to reset the associated property back to its original value.

    The only way I've managed to think of doing that is trying to call ::complete() on the animation which is part of the instanced delegate. The problem with this is that from what I've been able to read this isn't possible as you can't reliably access delegate instances.

    If there was some 'stopped' property on the animation where I could set the value I want whenever the animation isn't running, I'd be fine.

    Suggestions?

    1 Reply Last reply
    0
    • V Offline
      V Offline
      VRHans
      wrote on last edited by
      #2

      I'm an idiot. I can probably just drop a property on the model element itself and animate that. Then the delegate instance simply reference that property.

      Apologies.

      1 Reply Last reply
      0

      • Login

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