diff options
author | Martin Jones <martin.jones@nokia.com> | 2010-07-20 00:14:38 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2010-07-20 00:14:38 (GMT) |
commit | 17cc89e918a969d85d2b46631ee8743288c7586d (patch) | |
tree | 5157d7cd27194144440277aaca93167c12d67c4f /src/declarative | |
parent | cc08942aa57877fd4b8e309088ffe9b28a7deeb8 (diff) | |
download | Qt-17cc89e918a969d85d2b46631ee8743288c7586d.zip Qt-17cc89e918a969d85d2b46631ee8743288c7586d.tar.gz Qt-17cc89e918a969d85d2b46631ee8743288c7586d.tar.bz2 |
Ensure released VisualItemModel items are removed from the scene.
Also parent them back to the VIM to ensure correct destruction.
Task-number: QTBUG-12261
Diffstat (limited to 'src/declarative')
-rw-r--r-- | src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp index cfa1c6d..7952b97 100644 --- a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp +++ b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp @@ -77,7 +77,7 @@ public: QDeclarativeVisualItemModelPrivate() : QObjectPrivate() {} static void children_append(QDeclarativeListProperty<QDeclarativeItem> *prop, QDeclarativeItem *item) { - item->QObject::setParent(prop->object); + QDeclarative_setParent_noEvent(item, prop->object); static_cast<QDeclarativeVisualItemModelPrivate *>(prop->data)->children.append(item); static_cast<QDeclarativeVisualItemModelPrivate *>(prop->data)->itemAppended(); static_cast<QDeclarativeVisualItemModelPrivate *>(prop->data)->emitChildrenChanged(); @@ -185,9 +185,11 @@ QDeclarativeItem *QDeclarativeVisualItemModel::item(int index, bool) return d->children.at(index); } -QDeclarativeVisualModel::ReleaseFlags QDeclarativeVisualItemModel::release(QDeclarativeItem *) +QDeclarativeVisualModel::ReleaseFlags QDeclarativeVisualItemModel::release(QDeclarativeItem *item) { - // Nothing to do + if (item->scene()) + item->scene()->removeItem(item); + QDeclarative_setParent_noEvent(item, this); return 0; } |