summaryrefslogtreecommitdiffstats
path: root/src/declarative/graphicsitems
diff options
context:
space:
mode:
authorAlan Alpert <alan.alpert@nokia.com>2009-12-16 13:51:33 (GMT)
committerAlan Alpert <alan.alpert@nokia.com>2009-12-16 13:51:33 (GMT)
commitbb7a6e90375f4f546d1d5dc899e972d9389c2936 (patch)
tree527eaf4595c737e73ef82e837accb714df80e99c /src/declarative/graphicsitems
parent1e234c557ddbe5787b537f14ca383bd16e4e4cd1 (diff)
downloadQt-bb7a6e90375f4f546d1d5dc899e972d9389c2936.zip
Qt-bb7a6e90375f4f546d1d5dc899e972d9389c2936.tar.gz
Qt-bb7a6e90375f4f546d1d5dc899e972d9389c2936.tar.bz2
Fix bug in positioners where changes were not being watched
Task-number: QT-2638
Diffstat (limited to 'src/declarative/graphicsitems')
-rw-r--r--src/declarative/graphicsitems/qmlgraphicspositioners.cpp20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/declarative/graphicsitems/qmlgraphicspositioners.cpp b/src/declarative/graphicsitems/qmlgraphicspositioners.cpp
index b96b8b8..9f6baae 100644
--- a/src/declarative/graphicsitems/qmlgraphicspositioners.cpp
+++ b/src/declarative/graphicsitems/qmlgraphicspositioners.cpp
@@ -173,8 +173,20 @@ void QmlGraphicsBasePositioner::componentComplete()
QVariant QmlGraphicsBasePositioner::itemChange(GraphicsItemChange change,
const QVariant &value)
{
- if (change == ItemChildAddedChange ||
- change == ItemChildRemovedChange) {
+ Q_D(QmlGraphicsBasePositioner);
+ if (change == ItemChildAddedChange){
+ QmlGraphicsItem* child = value.value<QmlGraphicsItem*>();
+ if(!child)
+ return QVariant();
+ if(!d->watched.contains(child))
+ d->watchChanges(child);
+ prePositioning();
+ }else if (change == ItemChildRemovedChange) {
+ QmlGraphicsItem* child = value.value<QmlGraphicsItem*>();
+ if(!child)
+ return QVariant();
+ if(d->watched.contains(child))
+ d->unwatchChanges(child);
prePositioning();
}
@@ -212,10 +224,8 @@ void QmlGraphicsBasePositioner::prePositioning()
//Assumed that (aside from init) every add/remove triggers this check
//thus the above check will be triggered every time an item is removed
QSet<QmlGraphicsItem *> deletedItems = d->items - positionedItems.toSet();
- foreach(QmlGraphicsItem *child, deletedItems){
- d->unwatchChanges(child);
+ foreach(QmlGraphicsItem *child, deletedItems)
d->items -= child;
- }
}
doPositioning();
if(d->addTransition || d->moveTransition)