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)
: 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,7 +128,6 @@ void TimelineToolBar::reset()
if (recording())
m_recording->setChecked(false);
if (m_animatioCurveDialog)
m_curveModel->reset({});
}
@@ -172,7 +173,6 @@ 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);
} else {
m_timelineLabel->setText("");
@@ -181,7 +181,6 @@ void TimelineToolBar::setCurrentTimeline(const QmlTimeline &timeline)
void TimelineToolBar::setStartFrame(qreal frame)
{
if (m_animatioCurveDialog)
m_curveModel->setMinimumTime(frame);
auto text = QString::number(frame, 'f', 0);
@@ -191,7 +190,6 @@ void TimelineToolBar::setStartFrame(qreal frame)
void TimelineToolBar::setCurrentFrame(qreal frame)
{
if (m_animatioCurveDialog)
m_curveModel->setCurrentFrame(std::round(frame));
auto text = QString::number(frame, 'f', 0);
@@ -200,7 +198,6 @@ void TimelineToolBar::setCurrentFrame(qreal frame)
void TimelineToolBar::setEndFrame(qreal frame)
{
if (m_animatioCurveDialog)
m_curveModel->setMaximumTime(frame);
auto text = QString::number(frame, 'f', 0);
@@ -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)

View File

@@ -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;