summaryrefslogtreecommitdiffstats
path: root/src/gui/graphicsview/qgraphicsitem.cpp
diff options
context:
space:
mode:
authorMarco Bubke <marco.bubke@nokia.com>2010-09-30 14:27:25 (GMT)
committerMarco Bubke <marco.bubke@nokia.com>2010-09-30 15:36:36 (GMT)
commit3b43389b78925ce87d660c343c925fa280b91e11 (patch)
treefdf4b0e3e16e1b91d16d15bcb8f052fdd7861828 /src/gui/graphicsview/qgraphicsitem.cpp
parent1f8bb573f06234a3d13fb57de5eb644824d5024f (diff)
downloadQt-3b43389b78925ce87d660c343c925fa280b91e11.zip
Qt-3b43389b78925ce87d660c343c925fa280b91e11.tar.gz
Qt-3b43389b78925ce87d660c343c925fa280b91e11.tar.bz2
Add sendParentChangeNotification to QGraphicsItem
Fixes crash in creator. If flag is true notifications are sent. It is important that positioners work correctly and don't leak. Reviewed-By: Alexis Menard
Diffstat (limited to 'src/gui/graphicsview/qgraphicsitem.cpp')
-rw-r--r--src/gui/graphicsview/qgraphicsitem.cpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp
index b404692..3b18c31 100644
--- a/src/gui/graphicsview/qgraphicsitem.cpp
+++ b/src/gui/graphicsview/qgraphicsitem.cpp
@@ -7669,7 +7669,12 @@ void QGraphicsObject::updateMicroFocus()
void QGraphicsItemPrivate::children_append(QDeclarativeListProperty<QGraphicsObject> *list, QGraphicsObject *item)
{
- QGraphicsItemPrivate::get(item)->setParentItemHelper(static_cast<QGraphicsObject *>(list->object), /*newParentVariant=*/0, /*thisPointerVariant=*/0);
+ QGraphicsObject *graphicsObject = static_cast<QGraphicsObject *>(list->object);
+ if (QGraphicsItemPrivate::get(graphicsObject)->sendParentChangeNotification) {
+ item->setParentItem(graphicsObject);
+ } else {
+ QGraphicsItemPrivate::get(item)->setParentItemHelper(graphicsObject, 0, 0);
+ }
}
int QGraphicsItemPrivate::children_count(QDeclarativeListProperty<QGraphicsObject> *list)
@@ -7691,8 +7696,13 @@ void QGraphicsItemPrivate::children_clear(QDeclarativeListProperty<QGraphicsObje
{
QGraphicsItemPrivate *d = QGraphicsItemPrivate::get(static_cast<QGraphicsObject *>(list->object));
int childCount = d->children.count();
- for (int index = 0; index < childCount; index++)
- QGraphicsItemPrivate::get(d->children.at(0))->setParentItemHelper(0, /*newParentVariant=*/0, /*thisPointerVariant=*/0);
+ if (d->sendParentChangeNotification) {
+ for (int index = 0; index < childCount; index++)
+ d->children.at(0)->setParentItem(0);
+ } else {
+ for (int index = 0; index < childCount; index++)
+ QGraphicsItemPrivate::get(d->children.at(0))->setParentItemHelper(0, 0, 0);
+ }
}
/*!