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. Call function when state transition finishes?
Forum Updated to NodeBB v4.3 + New Features

Call function when state transition finishes?

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
2 Posts 1 Posters 304 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.
  • A Offline
    A Offline
    aatwo
    wrote on last edited by
    #1

    Hello. How can I run a function when a state transition animation finishes? For example, when a certain state is entered I fade out an overlay and would like to disable it when the animation is finished so it ceases to capture mouse events.

    1 Reply Last reply
    0
    • A Offline
      A Offline
      aatwo
      wrote on last edited by
      #2

      Hmmm I updated my import statement from 2.2 to 2.12 and now an onFinished property is available, however this signal never seems to be called. Apparently this happens when running is not set, but setting this property caused an error (QML OpacityAnimator: setRunning() cannot be used on non-root animation nodes).

      In the end I gave up trying to use the transitions. Instead I moved the overlay to it's own component, created a visible and hidden state for it and gave it a public bool property to control its animated visibility. On the main window state change I simply set this public property of the overlay component to true or false, and the in the overlay component I use the onPropertyChanged event to run some code which manually starts and stops the relevant animation (one for fade in and another for fade out). Also I think because the OpacityAnimator is at the root level of the overlay QML component it doesn't error and the onFinished() signal works as expected.

      I am genuinely suprised at how difficult this has been.

      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