forked from qt-creator/qt-creator
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>
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
@@ -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({});
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user