diff --git a/src/plugins/qmldesigner/components/timelineeditor/easingcurvedialog.cpp b/src/plugins/qmldesigner/components/timelineeditor/easingcurvedialog.cpp index 99e97d72de8..79f8141bf0b 100644 --- a/src/plugins/qmldesigner/components/timelineeditor/easingcurvedialog.cpp +++ b/src/plugins/qmldesigner/components/timelineeditor/easingcurvedialog.cpp @@ -159,9 +159,11 @@ EasingCurveDialog::EasingCurveDialog(const QList &frames, QWidget *pa resize(QSize(1421, 918)); } -void EasingCurveDialog::initialize(const QString &curveString) +void EasingCurveDialog::initialize(const PropertyName &propName, const QString &curveString) { EasingCurve curve; + m_easingCurveProperty = propName; + if (curveString.isEmpty()) { QEasingCurve qcurve; qcurve.addCubicBezierSegment(QPointF(0.2, 0.2), QPointF(0.8, 0.8), QPointF(1.0, 1.0)); @@ -180,11 +182,19 @@ void EasingCurveDialog::runDialog(const QList &frames, QWidget *paren EasingCurveDialog dialog(frames, parent); ModelNode current = frames.last(); + PropertyName propName; - if (current.hasBindingProperty("easing.bezierCurve")) - dialog.initialize(current.bindingProperty("easing.bezierCurve").expression()); - else - dialog.initialize(""); + NodeMetaInfo metaInfo = current.metaInfo(); + if (metaInfo.hasProperty("easing")) + propName = "easing.bezierCurve"; + else if (metaInfo.hasProperty("easingCurve")) + propName = "easingCurve.bezierCurve"; + + QString expression; + if (!propName.isEmpty() && current.hasBindingProperty(propName)) + expression = current.bindingProperty(propName).expression(); + + dialog.initialize(propName, expression); dialog.exec(); } @@ -207,7 +217,7 @@ bool EasingCurveDialog::apply() return view->executeInTransaction("EasingCurveDialog::apply", [this](){ auto expression = m_splineEditor->easingCurve().toString(); for (const auto &frame : qAsConst(m_frames)) - frame.bindingProperty("easing.bezierCurve").setExpression(expression); + frame.bindingProperty(m_easingCurveProperty).setExpression(expression); }); } diff --git a/src/plugins/qmldesigner/components/timelineeditor/easingcurvedialog.h b/src/plugins/qmldesigner/components/timelineeditor/easingcurvedialog.h index a8c026989c2..3f6ea95a5e0 100644 --- a/src/plugins/qmldesigner/components/timelineeditor/easingcurvedialog.h +++ b/src/plugins/qmldesigner/components/timelineeditor/easingcurvedialog.h @@ -49,7 +49,7 @@ class EasingCurveDialog : public QDialog public: EasingCurveDialog(const QList &frames, QWidget *parent = nullptr); - void initialize(const QString &curveString); + void initialize(const PropertyName &propName, const QString &curveString); static void runDialog(const QList &frames, QWidget *parent = nullptr); @@ -80,6 +80,8 @@ private: QLabel *m_label = nullptr; QList m_frames; + + PropertyName m_easingCurveProperty; }; } // namespace QmlDesigner