Prevent access of invalid frames

Changing keyframe positions while the timelineview
is hidden might lead to access of invalid frames
when showing the timelineview again.
Prevent this by calling invalidateScene from
within the showEvent.

Change-Id: Ib9c1e90de5bd7679823c4faeed9156da764c98a6
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
Knud Dollereder
2022-07-08 16:44:57 +02:00
committed by Thomas Hartmann
parent 1df1a065de
commit 8d30f1d004
2 changed files with 7 additions and 4 deletions

View File

@@ -444,10 +444,12 @@ void TimelineGraphicsScene::invalidateHeightForTarget(const ModelNode &target)
void TimelineGraphicsScene::invalidateScene() void TimelineGraphicsScene::invalidateScene()
{ {
if (timelineView()->isAttached()) {
ModelNode node = timelineView()->modelNodeForId( ModelNode node = timelineView()->modelNodeForId(
timelineWidget()->toolBar()->currentTimelineId()); timelineWidget()->toolBar()->currentTimelineId());
setTimeline(QmlTimeline(node)); setTimeline(QmlTimeline(node));
invalidateScrollbar(); invalidateScrollbar();
}
} }
void TimelineGraphicsScene::invalidateScrollbar() void TimelineGraphicsScene::invalidateScrollbar()

View File

@@ -625,6 +625,7 @@ void TimelineWidget::showEvent(QShowEvent *event)
m_timelineView->setEnabled(true); m_timelineView->setEnabled(true);
graphicsScene()->setWidth(m_graphicsView->viewport()->width()); graphicsScene()->setWidth(m_graphicsView->viewport()->width());
graphicsScene()->invalidateScene();
graphicsScene()->invalidateLayout(); graphicsScene()->invalidateLayout();
graphicsScene()->invalidate(); graphicsScene()->invalidate();
graphicsScene()->onShow(); graphicsScene()->onShow();