summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/declarative/util/qmlanimation.cpp2
-rw-r--r--tests/auto/declarative/animations/data/attached.qml34
-rw-r--r--tests/auto/declarative/animations/tst_animations.cpp12
3 files changed, 47 insertions, 1 deletions
diff --git a/src/declarative/util/qmlanimation.cpp b/src/declarative/util/qmlanimation.cpp
index efb4159..63044bc 100644
--- a/src/declarative/util/qmlanimation.cpp
+++ b/src/declarative/util/qmlanimation.cpp
@@ -223,7 +223,7 @@ void QmlAbstractAnimationPrivate::commence()
QmlMetaProperty QmlAbstractAnimationPrivate::createProperty(QObject *obj, const QString &str, QObject *infoObj)
{
- QmlMetaProperty prop = QmlMetaProperty::createProperty(obj, str);
+ QmlMetaProperty prop = QmlMetaProperty::createProperty(obj, str, qmlContext(infoObj));
if (!prop.isValid()) {
qmlInfo(infoObj) << QmlAbstractAnimation::tr("Cannot animate non-existant property \"%1\"").arg(str);
return QmlMetaProperty();
diff --git a/tests/auto/declarative/animations/data/attached.qml b/tests/auto/declarative/animations/data/attached.qml
new file mode 100644
index 0000000..0fb6f8c
--- /dev/null
+++ b/tests/auto/declarative/animations/data/attached.qml
@@ -0,0 +1,34 @@
+import Qt 4.6
+
+Rectangle {
+ width: 180; height: 200;
+
+ Component {
+ id: delegate
+ Rectangle {
+ id: wrapper
+ width: 180; height: 200
+ color: "blue"
+
+ states: State {
+ name: "otherState"
+ PropertyChanges { target: wrapper; color: "green" }
+ }
+
+ transitions: Transition {
+ PropertyAction { target: wrapper; property: "ListView.delayRemove"; value: true }
+ ScriptAction { script: console.log(ListView.delayRemove ? "on" : "off") }
+ }
+
+ Component.onCompleted: {
+ console.log(ListView.delayRemove ? "on" : "off");
+ wrapper.state = "otherState"
+ }
+ }
+ }
+
+ ListView {
+ model: 1
+ delegate: delegate
+ }
+}
diff --git a/tests/auto/declarative/animations/tst_animations.cpp b/tests/auto/declarative/animations/tst_animations.cpp
index 35eae73..7f043ba 100644
--- a/tests/auto/declarative/animations/tst_animations.cpp
+++ b/tests/auto/declarative/animations/tst_animations.cpp
@@ -67,6 +67,7 @@ private slots:
void propertiesTransition();
void easingStringConversion();
void invalidDuration();
+ void attached();
};
#define QTIMED_COMPARE(lhs, rhs) do { \
@@ -563,6 +564,17 @@ void tst_animations::invalidDuration()
QCOMPARE(pauseAnimation->duration(), 250);
}
+void tst_animations::attached()
+{
+ QmlEngine engine;
+
+ QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/attached.qml"));
+ QTest::ignoreMessage(QtDebugMsg, "off");
+ QTest::ignoreMessage(QtDebugMsg, "on");
+ QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(c.create());
+ QVERIFY(rect);
+}
+
QTEST_MAIN(tst_animations)
#include "tst_animations.moc"