Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to stop an animation when a new one starts c++
QtWS25 Last Chance

How to stop an animation when a new one starts c++

Scheduled Pinned Locked Moved Unsolved General and Desktop
timelineprogressbarc++
6 Posts 3 Posters 744 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
    MEsc
    wrote on 21 Nov 2022, 20:52 last edited by
    #1

    Hello, I have a problem. I have a progressbar connected with timeline animation. Always when I press enter the timeline should restart, but instead the old animation is running until its finished. And the new animation, which was created when i pressed enter is also running from start. I want that everytime I press enter the timeline starts new and the old one should stop. Is that possible? I try to solve this for days...

    J 1 Reply Last reply 22 Nov 2022, 06:29
    0
    • M MEsc
      21 Nov 2022, 20:52

      Hello, I have a problem. I have a progressbar connected with timeline animation. Always when I press enter the timeline should restart, but instead the old animation is running until its finished. And the new animation, which was created when i pressed enter is also running from start. I want that everytime I press enter the timeline starts new and the old one should stop. Is that possible? I try to solve this for days...

      J Offline
      J Offline
      jsulm
      Lifetime Qt Champion
      wrote on 22 Nov 2022, 06:29 last edited by
      #2

      @MEsc Why do you create new animation every time you press enter? Just reuse the existing animation: stop it if it is running (https://doc.qt.io/qt-5/qabstractanimation.html#stop) and start it again (https://doc.qt.io/qt-5/qabstractanimation.html#start).

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      M 1 Reply Last reply 22 Nov 2022, 09:10
      2
      • J jsulm
        22 Nov 2022, 06:29

        @MEsc Why do you create new animation every time you press enter? Just reuse the existing animation: stop it if it is running (https://doc.qt.io/qt-5/qabstractanimation.html#stop) and start it again (https://doc.qt.io/qt-5/qabstractanimation.html#start).

        M Offline
        M Offline
        MEsc
        wrote on 22 Nov 2022, 09:10 last edited by
        #3

        @jsulm that was an shortened version of my problem I have also a QLineEdit and I only want to stop the animation when QLineEdit is not empty.

        J 1 Reply Last reply 22 Nov 2022, 10:08
        0
        • M MEsc
          22 Nov 2022, 09:10

          @jsulm that was an shortened version of my problem I have also a QLineEdit and I only want to stop the animation when QLineEdit is not empty.

          J Offline
          J Offline
          jsulm
          Lifetime Qt Champion
          wrote on 22 Nov 2022, 10:08 last edited by
          #4

          @MEsc said in How to stop an animation when a new one starts c++:

          I only want to stop the animation when QLineEdit is not empty

          Then do so, what is the problem?

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          M 1 Reply Last reply 22 Nov 2022, 14:44
          0
          • J jsulm
            22 Nov 2022, 10:08

            @MEsc said in How to stop an animation when a new one starts c++:

            I only want to stop the animation when QLineEdit is not empty

            Then do so, what is the problem?

            M Offline
            M Offline
            MEsc
            wrote on 22 Nov 2022, 14:44 last edited by
            #5

            @jsulm when I press enter the function stops either if the QLineEdit is empty or not. It should first check if QLineEdit is empty and if not then stop the animation(here: QTimeLine).

            C 1 Reply Last reply 22 Nov 2022, 15:37
            0
            • M MEsc
              22 Nov 2022, 14:44

              @jsulm when I press enter the function stops either if the QLineEdit is empty or not. It should first check if QLineEdit is empty and if not then stop the animation(here: QTimeLine).

              C Offline
              C Offline
              Christian Ehrlicher
              Lifetime Qt Champion
              wrote on 22 Nov 2022, 15:37 last edited by
              #6

              @MEsc said in How to stop an animation when a new one starts c++:

              It should first check if QLineEdit is empty and if not then stop the animation(

              So change the order - I mean you're the programmer who programmed it so first checking for the QLineEdit and then doing something other shouldn't be that hard to add.

              Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
              Visit the Qt Academy at https://academy.qt.io/catalog

              1 Reply Last reply
              1

              2/6

              22 Nov 2022, 06:29

              topic:navigator.unread, 4
              • Login

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