summaryrefslogtreecommitdiffstats
path: root/src/declarative/graphicsitems/qdeclarativepositioners.cpp
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2010-03-22 02:19:17 (GMT)
committerMartin Jones <martin.jones@nokia.com>2010-03-22 02:19:17 (GMT)
commit84caca8dc56c569dc7b416d6a41e9ca8cda5f14f (patch)
tree488a81113b5e5add7b9f6be8ab09d5e87429dafd /src/declarative/graphicsitems/qdeclarativepositioners.cpp
parent897ecf7dab2a34dbf3abf5167dc19a405f65a112 (diff)
downloadQt-84caca8dc56c569dc7b416d6a41e9ca8cda5f14f.zip
Qt-84caca8dc56c569dc7b416d6a41e9ca8cda5f14f.tar.gz
Qt-84caca8dc56c569dc7b416d6a41e9ca8cda5f14f.tar.bz2
Ensure positioner animations are triggered correctly
Task-number: QTBUG-9219
Diffstat (limited to 'src/declarative/graphicsitems/qdeclarativepositioners.cpp')
-rw-r--r--src/declarative/graphicsitems/qdeclarativepositioners.cpp43
1 files changed, 25 insertions, 18 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativepositioners.cpp b/src/declarative/graphicsitems/qdeclarativepositioners.cpp
index 0f59a70..3391ac9 100644
--- a/src/declarative/graphicsitems/qdeclarativepositioners.cpp
+++ b/src/declarative/graphicsitems/qdeclarativepositioners.cpp
@@ -225,20 +225,21 @@ void QDeclarativeBasePositioner::prePositioning()
d->watchChanges(child);
positionedItems.append(posItem);
item = &positionedItems[positionedItems.count()-1];
+ item->isNew = true;
+ if (child->opacity() <= 0.0 || !child->isVisible())
+ item->isVisible = false;
} else {
item = &oldItems[wIdx];
+ if (child->opacity() <= 0.0 || !child->isVisible()) {
+ item->isVisible = false;
+ } else if (!item->isVisible) {
+ item->isVisible = true;
+ item->isNew = true;
+ } else {
+ item->isNew = false;
+ }
positionedItems.append(*item);
}
- if (child->opacity() <= 0.0 || !child->isVisible()) {
- item->isVisible = false;
- continue;
- }
- if (!item->isVisible) {
- item->isVisible = true;
- item->isNew = true;
- } else {
- item->isNew = false;
- }
}
doPositioning();
if(d->addTransition || d->moveTransition)
@@ -261,11 +262,14 @@ void QDeclarativeBasePositioner::positionX(int x, const PositionedItem &target)
{
Q_D(QDeclarativeBasePositioner);
if(d->type == Horizontal || d->type == Both){
- if(!d->addTransition && !d->moveTransition){
- target.item->setX(x);
- }else{
- if(target.isNew)
+ if (target.isNew) {
+ if (!d->addTransition)
+ target.item->setX(x);
+ else
d->addActions << QDeclarativeAction(target.item, QLatin1String("x"), QVariant(x));
+ } else if (x != target.item->x()) {
+ if (!d->moveTransition)
+ target.item->setX(x);
else
d->moveActions << QDeclarativeAction(target.item, QLatin1String("x"), QVariant(x));
}
@@ -276,11 +280,14 @@ void QDeclarativeBasePositioner::positionY(int y, const PositionedItem &target)
{
Q_D(QDeclarativeBasePositioner);
if(d->type == Vertical || d->type == Both){
- if(!d->addTransition && !d->moveTransition){
- target.item->setY(y);
- }else{
- if(target.isNew)
+ if (target.isNew) {
+ if (!d->addTransition)
+ target.item->setY(y);
+ else
d->addActions << QDeclarativeAction(target.item, QLatin1String("y"), QVariant(y));
+ } else if (y != target.item->y()) {
+ if (!d->moveTransition)
+ target.item->setY(y);
else
d->moveActions << QDeclarativeAction(target.item, QLatin1String("y"), QVariant(y));
}