Fix incorrect vertex data and rendering when shapes change scene

When changing scene, the stroke vertices were left with uninitialized
stroke colors when the item is re-attached to the scene. Marking the
shape data as overall dirty and triggering a polish ensures that the
data is kept in sync.

Change-Id: I3f472734a97908e6e8f6e58230c0c53dcc041868
Done-with: Fabian Kosmale <fabian.kosmale@qt.io>
Fixes: QTBUG-77332
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
This commit is contained in:
Simon Hausmann 2019-08-07 12:59:42 +02:00
parent 88cc9d692f
commit b407a77380
1 changed files with 5 additions and 0 deletions

View File

@ -969,6 +969,11 @@ void QQuickShape::itemChange(ItemChange change, const ItemChangeData &data)
// sync may have been deferred; do it now if the item became visible
if (change == ItemVisibleHasChanged && data.boolValue)
d->_q_shapePathChanged();
else if (change == QQuickItem::ItemSceneChange) {
for (int i = 0; i < d->sp.count(); ++i)
QQuickShapePathPrivate::get(d->sp[i])->dirty = QQuickShapePathPrivate::DirtyAll;
d->_q_shapePathChanged();
}
QQuickItem::itemChange(change, data);
}