diff options
Diffstat (limited to 'src/declarative/graphicsitems/qmlgraphicspositioners.cpp')
-rw-r--r-- | src/declarative/graphicsitems/qmlgraphicspositioners.cpp | 28 |
1 files changed, 11 insertions, 17 deletions
diff --git a/src/declarative/graphicsitems/qmlgraphicspositioners.cpp b/src/declarative/graphicsitems/qmlgraphicspositioners.cpp index ced9d55..65e63eb 100644 --- a/src/declarative/graphicsitems/qmlgraphicspositioners.cpp +++ b/src/declarative/graphicsitems/qmlgraphicspositioners.cpp @@ -70,15 +70,18 @@ void QmlGraphicsBasePositionerPrivate::watchChanges(QmlGraphicsItem *other) void QmlGraphicsBasePositionerPrivate::unwatchChanges(QmlGraphicsItem* other) { Q_Q(QmlGraphicsBasePositioner); - QObject::disconnect(other, SIGNAL(visibleChanged()), + bool stillAlive = false; //Use the return from disconnect to see if it was deleted or just reparented + stillAlive |= QObject::disconnect(other, SIGNAL(visibleChanged()), q, SLOT(prePositioning())); - QObject::disconnect(other, SIGNAL(opacityChanged()), + stillAlive |= QObject::disconnect(other, SIGNAL(opacityChanged()), q, SLOT(prePositioning())); - QObject::disconnect(other, SIGNAL(heightChanged()), + stillAlive |= QObject::disconnect(other, SIGNAL(heightChanged()), q, SLOT(prePositioning())); - QObject::disconnect(other, SIGNAL(widthChanged()), + stillAlive |= QObject::disconnect(other, SIGNAL(widthChanged()), q, SLOT(prePositioning())); - static_cast<QmlGraphicsItemPrivate*>(QGraphicsItemPrivate::get(other))->unregisterSiblingOrderNotification(this); + if(stillAlive) + static_cast<QmlGraphicsItemPrivate*>(QGraphicsItemPrivate::get(other)) + ->unregisterSiblingOrderNotification(this); watched.removeAll(other); } @@ -266,18 +269,9 @@ void QmlGraphicsBasePositioner::prePositioning() positionedItems << child; } QSet<QmlGraphicsItem *> deletedItems = d->_items - allItems; - foreach(QmlGraphicsItem *child, d->_items){ - if (!allItems.contains(child)){ - if (!deletedItems.contains(child)) { - QObject::disconnect(child, SIGNAL(opacityChanged()), - this, SLOT(prePositioning())); - QObject::disconnect(child, SIGNAL(heightChanged()), - this, SLOT(prePositioning())); - QObject::disconnect(child, SIGNAL(widthChanged()), - this, SLOT(prePositioning())); - } - d->_items -= child; - } + foreach(QmlGraphicsItem *child, deletedItems){ + d->unwatchChanges(child); + d->_items -= child; } d->_animated.clear(); doPositioning(); |