forked from qt-creator/qt-creator
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:
@@ -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)
|
||||
|
@@ -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;
|
||||
|
||||
|
Reference in New Issue
Block a user