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

QTimeline fails to start() after second setDuration() call if first duration is larger than the second one

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Out of scope
    • Icon: P2: Important P2: Important
    • Some future release
    • 4.2.3
    • Other
    • None

      If one tries to set a new duration that is shorter than the original duration, then start() will not work.
      Calling start() again will work as the duration now is reset.
      In the example below, wait until the first "animation" is finished - then click the button.

      -------

      #include <QtGui>

      class myObject : public QPushButton
      {
      Q_OBJECT
      public:
      myObject()

      { setText("Click me"); myTimeLine = new QTimeLine(1000, this); myTimeLine->setDuration(2001); myTimeLine->setFrameRange(0, 500); connect(myTimeLine, SIGNAL(frameChanged(int)), this, SLOT(animationFrame(int))); connect(this, SIGNAL(clicked()), this, SLOT(changeDuration())); }

      public slots:
      void animationFrame(int i)

      { qDebug() << "enters the slot" << i; }

      void changeDuration()

      { myTimeLine->setDuration(2000); myTimeLine->start(); }

      void doIt()

      { myTimeLine->start(); }

      private:
      QTimeLine *myTimeLine;
      };

      #include "main.moc"
      int main(int argc, char **argv)
      {
      QApplication app(argc, argv);
      myObject obj;
      obj.show();
      obj.doIt();
      return app.exec();
      }

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            hanssen Andreas Aardal Hanssen (closed Nokia identity) (Inactive)
            sanonymous Nokia Qt Support (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes