summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/declarative/qml/qmlvmemetaobject.cpp2
-rw-r--r--src/declarative/util/qmlanimation_p.h3
-rw-r--r--tests/auto/declarative/behaviors/data/parent.qml28
-rw-r--r--tests/auto/declarative/behaviors/tst_behaviors.cpp18
4 files changed, 48 insertions, 3 deletions
diff --git a/src/declarative/qml/qmlvmemetaobject.cpp b/src/declarative/qml/qmlvmemetaobject.cpp
index 0886f1a..8faa922 100644
--- a/src/declarative/qml/qmlvmemetaobject.cpp
+++ b/src/declarative/qml/qmlvmemetaobject.cpp
@@ -110,7 +110,7 @@ int QmlVMEMetaObject::metaCall(QMetaObject::Call c, int _id, void **a)
QPair<int, QmlPropertyValueInterceptor*> pair = interceptors.value(id);
int valueIndex = pair.first;
QmlPropertyValueInterceptor *vi = pair.second;
- QVariant::Type type = property(id).type();
+ int type = property(id).userType();
if (type != QVariant::Invalid) {
if (valueIndex != -1) {
diff --git a/src/declarative/util/qmlanimation_p.h b/src/declarative/util/qmlanimation_p.h
index cb45266..6a69e4d 100644
--- a/src/declarative/util/qmlanimation_p.h
+++ b/src/declarative/util/qmlanimation_p.h
@@ -353,8 +353,7 @@ public:
class Q_AUTOTEST_EXPORT QmlVector3dAnimation : public QmlPropertyAnimation
{
-
- Q_OBJECT
+ Q_OBJECT
Q_DECLARE_PRIVATE(QmlPropertyAnimation)
Q_PROPERTY(QVector3D from READ from WRITE setFrom NOTIFY fromChanged)
diff --git a/tests/auto/declarative/behaviors/data/parent.qml b/tests/auto/declarative/behaviors/data/parent.qml
new file mode 100644
index 0000000..4f4911b
--- /dev/null
+++ b/tests/auto/declarative/behaviors/data/parent.qml
@@ -0,0 +1,28 @@
+import Qt 4.6
+Rectangle {
+ width: 400
+ height: 400
+ Rectangle {
+ id: rect
+ objectName: "MyRect"
+ width: 100; height: 100; color: "green"
+ parent: Behavior {
+ SequentialAnimation {
+ PauseAnimation { duration: 200 }
+ PropertyAction {}
+ }
+ }
+ }
+ Item {
+ id: newParent
+ objectName: "NewParent"
+ x: 100
+ }
+ states: State {
+ name: "reparented"
+ PropertyChanges {
+ target: rect
+ parent: newParent
+ }
+ }
+}
diff --git a/tests/auto/declarative/behaviors/tst_behaviors.cpp b/tests/auto/declarative/behaviors/tst_behaviors.cpp
index fe6bc6f..ae1af0e 100644
--- a/tests/auto/declarative/behaviors/tst_behaviors.cpp
+++ b/tests/auto/declarative/behaviors/tst_behaviors.cpp
@@ -58,6 +58,7 @@ private slots:
void cppTriggered();
void loop();
void colorBehavior();
+ void parentBehavior();
void replaceBinding();
//void transitionOverrides();
void group();
@@ -134,6 +135,23 @@ void tst_behaviors::colorBehavior()
QVERIFY(color != QColor("red") && color != QColor("green")); //i.e. the behavior has been triggered
}
+void tst_behaviors::parentBehavior()
+{
+ QmlEngine engine;
+ QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/parent.qml"));
+ QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(c.create());
+ QVERIFY(rect);
+
+ rect->setState("reparented");
+ QTest::qWait(100);
+ QmlGraphicsItem *newParent = rect->findChild<QmlGraphicsItem*>("NewParent");
+ QmlGraphicsItem *parent = rect->findChild<QmlGraphicsRectangle*>("MyRect")->parentItem();
+ QVERIFY(parent != newParent);
+ QTest::qWait(300);
+ parent = rect->findChild<QmlGraphicsRectangle*>("MyRect")->parentItem();
+ QVERIFY(parent == newParent);
+}
+
void tst_behaviors::replaceBinding()
{
QmlEngine engine;