summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/src/declarative/scope.qdoc2
-rw-r--r--src/declarative/util/qmltransitionmanager.cpp6
-rw-r--r--tests/auto/declarative/states/tst_states.cpp27
3 files changed, 32 insertions, 3 deletions
diff --git a/doc/src/declarative/scope.qdoc b/doc/src/declarative/scope.qdoc
index 14efa59..fc678d1 100644
--- a/doc/src/declarative/scope.qdoc
+++ b/doc/src/declarative/scope.qdoc
@@ -215,7 +215,7 @@ Item { // Scope object for Script block 1
\endcode
One notable characteristic of the scope object is its interaction with \l {Attached Properties}.
-As attached properties exist on all object, an attached property reference that is not
+As attached properties exist on all objects, an attached property reference that is not
explicitly prefixed by an id will \e always resolve to the attached property on the scope
object.
diff --git a/src/declarative/util/qmltransitionmanager.cpp b/src/declarative/util/qmltransitionmanager.cpp
index d1db9ec..ba726db 100644
--- a/src/declarative/util/qmltransitionmanager.cpp
+++ b/src/declarative/util/qmltransitionmanager.cpp
@@ -236,8 +236,11 @@ void QmlTransitionManager::transition(const QList<Action> &list,
action.property.write(action.toValue);
}
}
- if (!transition)
+ if (!transition) {
d->applyBindings();
+ if (d->state)
+ static_cast<QmlStatePrivate*>(QObjectPrivate::get(d->state))->complete();
+ }
}
void QmlTransitionManager::cancel()
@@ -262,7 +265,6 @@ void QmlTransitionManager::cancel()
}
d->bindingsList.clear();
d->completeList.clear();
-
}
QT_END_NAMESPACE
diff --git a/tests/auto/declarative/states/tst_states.cpp b/tests/auto/declarative/states/tst_states.cpp
index 92d278a..a4da1f1 100644
--- a/tests/auto/declarative/states/tst_states.cpp
+++ b/tests/auto/declarative/states/tst_states.cpp
@@ -68,6 +68,7 @@ private slots:
void restoreEntryValues();
void explicitChanges();
void propertyErrors();
+ void incorrectRestoreBug();
};
void tst_states::basicChanges()
@@ -711,6 +712,32 @@ void tst_states::propertyErrors()
rect->setState("blue");
}
+void tst_states::incorrectRestoreBug()
+{
+ QmlEngine engine;
+
+ QmlComponent rectComponent(&engine, SRCDIR "/data/basicChanges.qml");
+ QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(rectComponent.create());
+ QVERIFY(rect != 0);
+
+ QCOMPARE(rect->color(),QColor("red"));
+
+ rect->setState("blue");
+ QCOMPARE(rect->color(),QColor("blue"));
+
+ rect->setState("");
+ QCOMPARE(rect->color(),QColor("red"));
+
+ // make sure if we change the base state value, we then restore to it correctly
+ rect->setColor(QColor("green"));
+
+ rect->setState("blue");
+ QCOMPARE(rect->color(),QColor("blue"));
+
+ rect->setState("");
+ QCOMPARE(rect->color(),QColor("green"));
+}
+
QTEST_MAIN(tst_states)
#include "tst_states.moc"