Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-45220

Animator does not stop even if running==false

    XMLWordPrintable

Details

    Description

      In attached example, if "running = false", pause() or stop() is called in Component.onComplete:

      {..}

      , animator keeps running.

      import QtQuick 2.4
      import QtQuick.Window 2.2
      import QtQuick.Controls 1.2
      
      Window {
          visible: true
          width: 300
          height: 100
      
          Text {
              id: label
              text: "abc"
          }
      
          XAnimator {
              id: anim
              loops: Animation.Infinite
              running: true
              target: label
              from: 0
              to: 50
              duration: 1000
              onStopped: console.log("animator was stopped")
          }
      
          MouseArea {
              anchors.fill: parent
              onClicked: {
                  console.log(">onClicked");
                  if (anim.paused)
                      anim.resume();
                  else
                      anim.pause();
              //    anim.running = !anim.running
                  console.log("<onClicked");
              }
          }
      
          Component.onCompleted: {
              console.log(">Component.onCompleted");
              anim.pause();
      //        anim.running = false
              console.log("<Component.onCompleted");
          }
      
          Text {
              anchors.bottom: parent.bottom
              text: "is running: " + anim.running + ", is paused: " + anim.paused
          }
      
      }
      

      Attachments

        1. qtbug45220_diag.diff
          3 kB
        2. qtbug45220.tar.gz
          0.9 kB
        3. qtbug45220.zip
          2 kB
        For Gerrit Dashboard: QTBUG-45220
        # Subject Branch Project Status CR V

        Activity

          People

            sletta Gunnar Sletta
            poikelin Joni Poikelin
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes