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

QEasingCurve::setType() doesn't work if setPeriod() was used before.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 5.5.0
    • 5.2.1
    • None
    • ec5f402cfd0bc439cd373ca8c99c59cb11556966

    Description

      The following snippet prints different values even though the two easingcurves are seemingly configured the same.

      The issue is that setType_helper() (qeasingcurve.cpp:1337) checks for an existing config and doesn't really do what its supposed to do if there is one. Using setPeriod() before setType() generates such a config with the type set at that time, which is QEasingCurve::Linear by default.

      #include <QEasingCurve>
      #include <QDebug>

      int main(int argc, char *argv[]) {
      QEasingCurve c1;
      c1.setType(QEasingCurve::OutSine);
      c1.setPeriod(1);

      QEasingCurve c2;
      c2.setPeriod(1);
      c2.setType(QEasingCurve::OutSine);

      qDebug() << c1.valueForProgress(.8) << c2.valueForProgress(.8);
      }

      Attachments

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

        Activity

          People

            smd Jan Arve
            mzanetti Michael Zanetti
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes