aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/qmldesigner/components/timelineeditor
diff options
context:
space:
mode:
authorThomas Hartmann <thomas.hartmann@qt.io>2020-02-04 14:25:30 +0100
committerThomas Hartmann <thomas.hartmann@qt.io>2020-02-06 17:18:21 +0000
commit40b2b958640bab994c3569555b302f66c6f6b65b (patch)
treeeaa8601bdc394415a300023acd5914d8596b4c1c /src/plugins/qmldesigner/components/timelineeditor
parente68e7f723e17b7c12eba48c988309d8373b8abcb (diff)
QmlDesigner: Fix QTC_ASSERT
The method setTimelineRecording() assumes a valid timeline. Change-Id: If57dac581fb14e4871745929d7f202d1e831fc40 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/timelineview.cpp4
-rw-r--r--src/plugins/qmldesigner/components/timelineeditor/timelinewidget.cpp8
2 files changed, 9 insertions, 3 deletions
diff --git a/src/plugins/qmldesigner/components/timelineeditor/timelineview.cpp b/src/plugins/qmldesigner/components/timelineeditor/timelineview.cpp
index eb4b270a99..61ac1aba59 100644
--- a/src/plugins/qmldesigner/components/timelineeditor/timelineview.cpp
+++ b/src/plugins/qmldesigner/components/timelineeditor/timelineview.cpp
@@ -84,7 +84,9 @@ void TimelineView::modelAttached(Model *model)
void TimelineView::modelAboutToBeDetached(Model *model)
{
m_timelineWidget->reset();
- setTimelineRecording(false);
+ const bool empty = getTimelines().isEmpty();
+ if (!empty)
+ setTimelineRecording(false);
AbstractView::modelAboutToBeDetached(model);
}
diff --git a/src/plugins/qmldesigner/components/timelineeditor/timelinewidget.cpp b/src/plugins/qmldesigner/components/timelineeditor/timelinewidget.cpp
index 7d64fad56a..914a16b056 100644
--- a/src/plugins/qmldesigner/components/timelineeditor/timelinewidget.cpp
+++ b/src/plugins/qmldesigner/components/timelineeditor/timelinewidget.cpp
@@ -486,11 +486,15 @@ void TimelineWidget::setupScrollbar(int min, int max, int current)
void TimelineWidget::setTimelineId(const QString &id)
{
- setTimelineActive(!m_timelineView->getTimelines().isEmpty());
- if (m_timelineView->isAttached()) {
+ const bool empty = m_timelineView->getTimelines().isEmpty();
+ setTimelineActive(!empty);
+ 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({});
}
}