forked from qt-creator/qt-creator
QmlDesigner: Keep hasActiveTimeline QML context property up to date
Change hasActiveTimeline QML context property setting to be based on current timeline change notifications instead of timeline node creation, as the timeline will not be valid at the time of the node creation. That also failed to detect timeline deletion. Also fixed the timeline logic to clear current timeline from model when the timeline is deleted. Change-Id: I9191300c964bc624a958003b6aa0d5d9e77ddf9a Fixes: QDS-2139 Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
@@ -357,12 +357,9 @@ bool PropertyEditorView::locked() const
|
||||
return m_locked;
|
||||
}
|
||||
|
||||
void PropertyEditorView::nodeCreated(const ModelNode &modelNode)
|
||||
void PropertyEditorView::currentTimelineChanged(const ModelNode &)
|
||||
{
|
||||
if (!m_qmlBackEndForCurrentType->contextObject()->hasActiveTimeline()
|
||||
&& QmlTimeline::isValidQmlTimeline(modelNode)) {
|
||||
m_qmlBackEndForCurrentType->contextObject()->setHasActiveTimeline(QmlTimeline::hasActiveTimeline(this));
|
||||
}
|
||||
m_qmlBackEndForCurrentType->contextObject()->setHasActiveTimeline(QmlTimeline::hasActiveTimeline(this));
|
||||
}
|
||||
|
||||
void PropertyEditorView::updateSize()
|
||||
|
@@ -94,7 +94,7 @@ public:
|
||||
|
||||
bool locked() const;
|
||||
|
||||
void nodeCreated(const ModelNode &createdNode) override;
|
||||
void currentTimelineChanged(const ModelNode &node) override;
|
||||
|
||||
protected:
|
||||
void timerEvent(QTimerEvent *event) override;
|
||||
|
@@ -386,9 +386,7 @@ void TimelineView::setTimelineRecording(bool value)
|
||||
{
|
||||
ModelNode node = widget()->graphicsScene()->currentTimeline();
|
||||
|
||||
QTC_ASSERT(node.isValid(), return );
|
||||
|
||||
if (value) {
|
||||
if (value && node.isValid()) {
|
||||
activateTimelineRecording(node);
|
||||
} else {
|
||||
deactivateTimelineRecording();
|
||||
|
@@ -563,11 +563,11 @@ void TimelineWidget::setTimelineId(const QString &id)
|
||||
if (m_timelineView->isAttached() && !empty) {
|
||||
m_toolbar->setCurrentTimeline(m_timelineView->modelNodeForId(id));
|
||||
m_toolbar->setCurrentState(m_timelineView->currentState().name());
|
||||
m_timelineView->setTimelineRecording(false);
|
||||
} else {
|
||||
m_toolbar->setCurrentTimeline({});
|
||||
m_toolbar->setCurrentState({});
|
||||
}
|
||||
m_timelineView->setTimelineRecording(false);
|
||||
}
|
||||
|
||||
void TimelineWidget::setTimelineActive(bool b)
|
||||
|
Reference in New Issue
Block a user