QmlDesigner: Revert Shorten lifetime of AnimationCurveDialog

This reverts commit c0637b8283.
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>
This commit is contained in:
Thomas Hartmann
2020-02-04 13:15:05 +00:00
parent a6e6a53e82
commit 7ff4ebff1e
2 changed files with 10 additions and 26 deletions

View File

@@ -104,8 +104,10 @@ QAction *createAction(const Core::Id &id,
TimelineToolBar::TimelineToolBar(QWidget *parent) TimelineToolBar::TimelineToolBar(QWidget *parent)
: QToolBar(parent) : QToolBar(parent)
, m_grp() , m_grp()
, m_dialog(Core::ICore::dialogParent())
, m_curveModel(new AnimationCurveEditorModel(0., 500.)) , m_curveModel(new AnimationCurveEditorModel(0., 500.))
{ {
m_dialog.setModel(m_curveModel);
connect(m_curveModel, connect(m_curveModel,
&AnimationCurveEditorModel::currentFrameChanged, &AnimationCurveEditorModel::currentFrameChanged,
this, this,
@@ -126,7 +128,6 @@ void TimelineToolBar::reset()
if (recording()) if (recording())
m_recording->setChecked(false); m_recording->setChecked(false);
if (m_animatioCurveDialog)
m_curveModel->reset({}); m_curveModel->reset({});
} }
@@ -172,7 +173,6 @@ void TimelineToolBar::setCurrentTimeline(const QmlTimeline &timeline)
setStartFrame(timeline.startKeyframe()); setStartFrame(timeline.startKeyframe());
setEndFrame(timeline.endKeyframe()); setEndFrame(timeline.endKeyframe());
m_timelineLabel->setText(timeline.modelNode().id()); m_timelineLabel->setText(timeline.modelNode().id());
if (m_animatioCurveDialog)
m_curveModel->setTimeline(timeline); m_curveModel->setTimeline(timeline);
} else { } else {
m_timelineLabel->setText(""); m_timelineLabel->setText("");
@@ -181,7 +181,6 @@ void TimelineToolBar::setCurrentTimeline(const QmlTimeline &timeline)
void TimelineToolBar::setStartFrame(qreal frame) void TimelineToolBar::setStartFrame(qreal frame)
{ {
if (m_animatioCurveDialog)
m_curveModel->setMinimumTime(frame); m_curveModel->setMinimumTime(frame);
auto text = QString::number(frame, 'f', 0); auto text = QString::number(frame, 'f', 0);
@@ -191,7 +190,6 @@ void TimelineToolBar::setStartFrame(qreal frame)
void TimelineToolBar::setCurrentFrame(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); auto text = QString::number(frame, 'f', 0);
@@ -200,7 +198,6 @@ void TimelineToolBar::setCurrentFrame(qreal frame)
void TimelineToolBar::setEndFrame(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); auto text = QString::number(frame, 'f', 0);
@@ -235,10 +232,9 @@ void TimelineToolBar::openAnimationCurveEditor()
timeline = tlv->timelineForState(tlv->currentState()); timeline = tlv->timelineForState(tlv->currentState());
} }
ensureAnimationCurveDialog(); m_dialog.refresh();
m_animatioCurveDialog->refresh();
m_curveModel->setTimeline(timeline); m_curveModel->setTimeline(timeline);
m_animatioCurveDialog->show(); m_dialog.show();
} }
void TimelineToolBar::updateCurve(DesignTools::PropertyTreeItem *item) void TimelineToolBar::updateCurve(DesignTools::PropertyTreeItem *item)
@@ -505,15 +501,6 @@ void TimelineToolBar::setupCurrentFrameValidator()
m_lastFrame->text().toInt()); 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) void TimelineToolBar::resizeEvent(QResizeEvent *event)
{ {
Q_UNUSED(event) Q_UNUSED(event)

View File

@@ -30,8 +30,6 @@
#include <QToolBar> #include <QToolBar>
#include <QPointer>
QT_FORWARD_DECLARE_CLASS(QLabel) QT_FORWARD_DECLARE_CLASS(QLabel)
QT_FORWARD_DECLARE_CLASS(QLineEdit) QT_FORWARD_DECLARE_CLASS(QLineEdit)
QT_FORWARD_DECLARE_CLASS(QObject) QT_FORWARD_DECLARE_CLASS(QObject)
@@ -104,11 +102,10 @@ private:
void createRightControls(); void createRightControls();
void addSpacing(int width); void addSpacing(int width);
void setupCurrentFrameValidator(); void setupCurrentFrameValidator();
void ensureAnimationCurveDialog();
QList<QObject *> m_grp; QList<QObject *> m_grp;
QPointer<AnimationCurveDialog> m_animatioCurveDialog; AnimationCurveDialog m_dialog;
AnimationCurveEditorModel *m_curveModel = nullptr; AnimationCurveEditorModel *m_curveModel = nullptr;