diff options
author | Thomas Hartmann <thomas.hartmann@qt.io> | 2020-02-04 13:15:05 +0000 |
---|---|---|
committer | Thomas Hartmann <thomas.hartmann@qt.io> | 2020-02-06 17:17:33 +0000 |
commit | 7ff4ebff1e0a948d7ba37976e504a754cf6ac1f2 (patch) | |
tree | 16d2eb6aa656ac763b9d03b86faef5f8514d4c2d /src/plugins/qmldesigner/components/timelineeditor | |
parent | a6e6a53e82a06b0c78c20e44643f7bdc050862df (diff) |
QmlDesigner: Revert Shorten lifetime of AnimationCurveDialog
This reverts commit c0637b8283ec884cad6aa8119f1f99d010419df5.
Reason for revert: Does not fix the issue and is unnecessary complicated
Change-Id: I3a1d48a736241ca031462c7694bf21afe93dcccb
Reviewed-by: Knud Dollereder <knud.dollereder@qt.io>
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Diffstat (limited to 'src/plugins/qmldesigner/components/timelineeditor')
-rw-r--r-- | src/plugins/qmldesigner/components/timelineeditor/timelinetoolbar.cpp | 31 | ||||
-rw-r--r-- | src/plugins/qmldesigner/components/timelineeditor/timelinetoolbar.h | 5 |
2 files changed, 10 insertions, 26 deletions
diff --git a/src/plugins/qmldesigner/components/timelineeditor/timelinetoolbar.cpp b/src/plugins/qmldesigner/components/timelineeditor/timelinetoolbar.cpp index 20ac9e22cd..4c4e1e38f0 100644 --- a/src/plugins/qmldesigner/components/timelineeditor/timelinetoolbar.cpp +++ b/src/plugins/qmldesigner/components/timelineeditor/timelinetoolbar.cpp @@ -104,8 +104,10 @@ QAction *createAction(const Core::Id &id, TimelineToolBar::TimelineToolBar(QWidget *parent) : QToolBar(parent) , m_grp() + , m_dialog(Core::ICore::dialogParent()) , m_curveModel(new AnimationCurveEditorModel(0., 500.)) { + m_dialog.setModel(m_curveModel); connect(m_curveModel, &AnimationCurveEditorModel::currentFrameChanged, this, @@ -126,8 +128,7 @@ void TimelineToolBar::reset() if (recording()) m_recording->setChecked(false); - if (m_animatioCurveDialog) - m_curveModel->reset({}); + m_curveModel->reset({}); } bool TimelineToolBar::recording() const @@ -172,8 +173,7 @@ void TimelineToolBar::setCurrentTimeline(const QmlTimeline &timeline) setStartFrame(timeline.startKeyframe()); setEndFrame(timeline.endKeyframe()); m_timelineLabel->setText(timeline.modelNode().id()); - if (m_animatioCurveDialog) - m_curveModel->setTimeline(timeline); + m_curveModel->setTimeline(timeline); } else { m_timelineLabel->setText(""); } @@ -181,8 +181,7 @@ void TimelineToolBar::setCurrentTimeline(const QmlTimeline &timeline) void TimelineToolBar::setStartFrame(qreal frame) { - if (m_animatioCurveDialog) - m_curveModel->setMinimumTime(frame); + m_curveModel->setMinimumTime(frame); auto text = QString::number(frame, 'f', 0); m_firstFrame->setText(text); @@ -191,8 +190,7 @@ void TimelineToolBar::setStartFrame(qreal frame) void TimelineToolBar::setCurrentFrame(qreal frame) { - if (m_animatioCurveDialog) - m_curveModel->setCurrentFrame(std::round(frame)); + m_curveModel->setCurrentFrame(std::round(frame)); auto text = QString::number(frame, 'f', 0); m_currentFrame->setText(text); @@ -200,8 +198,7 @@ void TimelineToolBar::setCurrentFrame(qreal frame) void TimelineToolBar::setEndFrame(qreal frame) { - if (m_animatioCurveDialog) - m_curveModel->setMaximumTime(frame); + m_curveModel->setMaximumTime(frame); auto text = QString::number(frame, 'f', 0); m_lastFrame->setText(text); @@ -235,10 +232,9 @@ void TimelineToolBar::openAnimationCurveEditor() timeline = tlv->timelineForState(tlv->currentState()); } - ensureAnimationCurveDialog(); - m_animatioCurveDialog->refresh(); + m_dialog.refresh(); m_curveModel->setTimeline(timeline); - m_animatioCurveDialog->show(); + m_dialog.show(); } void TimelineToolBar::updateCurve(DesignTools::PropertyTreeItem *item) @@ -505,15 +501,6 @@ void TimelineToolBar::setupCurrentFrameValidator() m_lastFrame->text().toInt()); } -void TimelineToolBar::ensureAnimationCurveDialog() -{ - if (!m_animatioCurveDialog) { - m_animatioCurveDialog = new AnimationCurveDialog(Core::ICore::dialogParent()); - m_animatioCurveDialog->setAttribute(Qt::WA_DeleteOnClose); - m_animatioCurveDialog->setModel(m_curveModel); - } -} - void TimelineToolBar::resizeEvent(QResizeEvent *event) { Q_UNUSED(event) diff --git a/src/plugins/qmldesigner/components/timelineeditor/timelinetoolbar.h b/src/plugins/qmldesigner/components/timelineeditor/timelinetoolbar.h index 807d438e80..a95af873da 100644 --- a/src/plugins/qmldesigner/components/timelineeditor/timelinetoolbar.h +++ b/src/plugins/qmldesigner/components/timelineeditor/timelinetoolbar.h @@ -30,8 +30,6 @@ #include <QToolBar> -#include <QPointer> - QT_FORWARD_DECLARE_CLASS(QLabel) QT_FORWARD_DECLARE_CLASS(QLineEdit) QT_FORWARD_DECLARE_CLASS(QObject) @@ -104,11 +102,10 @@ private: void createRightControls(); void addSpacing(int width); void setupCurrentFrameValidator(); - void ensureAnimationCurveDialog(); QList<QObject *> m_grp; - QPointer<AnimationCurveDialog> m_animatioCurveDialog; + AnimationCurveDialog m_dialog; AnimationCurveEditorModel *m_curveModel = nullptr; |