Property changes in Component.onCompleted should trigger Behaviors.
Task-number: QTBUG-22555 Change-Id: Ieffb8037d7289113ea4f629ba3b578a845d2cb28 Reviewed-by: Martin Jones <martin.jones@nokia.com>
This commit is contained in:
parent
9eca40d0da
commit
26ec7d7e40
|
@ -1384,6 +1384,18 @@ QDeclarativeContextData *QDeclarativeVME::complete(const Interrupt &interrupt)
|
|||
}
|
||||
parserStatus.deallocate();
|
||||
|
||||
for (int ii = 0; ii < finalizeCallbacks.count(); ++ii) {
|
||||
QDeclarativeEnginePrivate::FinalizeCallback callback = finalizeCallbacks.at(ii);
|
||||
QObject *obj = callback.first;
|
||||
if (obj) {
|
||||
void *args[] = { 0 };
|
||||
QMetaObject::metacall(obj, QMetaObject::InvokeMetaMethod, callback.second, args);
|
||||
}
|
||||
if (watcher.hasRecursed())
|
||||
return 0;
|
||||
}
|
||||
finalizeCallbacks.clear();
|
||||
|
||||
while (componentAttached) {
|
||||
QDeclarativeComponentAttached *a = componentAttached;
|
||||
a->rem();
|
||||
|
@ -1397,18 +1409,6 @@ QDeclarativeContextData *QDeclarativeVME::complete(const Interrupt &interrupt)
|
|||
return 0;
|
||||
}
|
||||
|
||||
for (int ii = 0; ii < finalizeCallbacks.count(); ++ii) {
|
||||
QDeclarativeEnginePrivate::FinalizeCallback callback = finalizeCallbacks.at(ii);
|
||||
QObject *obj = callback.first;
|
||||
if (obj) {
|
||||
void *args[] = { 0 };
|
||||
QMetaObject::metacall(obj, QMetaObject::InvokeMetaMethod, callback.second, args);
|
||||
}
|
||||
if (watcher.hasRecursed())
|
||||
return 0;
|
||||
}
|
||||
finalizeCallbacks.clear();
|
||||
|
||||
QDeclarativeContextData *rv = rootContext;
|
||||
|
||||
reset();
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
import QtQuick 2.0
|
||||
|
||||
Rectangle {
|
||||
width: 400
|
||||
height: 400
|
||||
|
||||
Rectangle {
|
||||
id: innerRect
|
||||
width: 100; height: 100
|
||||
color: "green"
|
||||
Behavior on x { NumberAnimation {} }
|
||||
}
|
||||
|
||||
Component.onCompleted: innerRect.x = 100
|
||||
}
|
|
@ -77,6 +77,7 @@ private slots:
|
|||
void runningTrue();
|
||||
void sameValue();
|
||||
void delayedRegistration();
|
||||
void startOnCompleted();
|
||||
};
|
||||
|
||||
void tst_qdeclarativebehaviors::simpleBehavior()
|
||||
|
@ -432,6 +433,25 @@ void tst_qdeclarativebehaviors::delayedRegistration()
|
|||
QTRY_COMPARE(innerRect->property("x").toInt(), int(100));
|
||||
}
|
||||
|
||||
//QTBUG-22555
|
||||
void tst_qdeclarativebehaviors::startOnCompleted()
|
||||
{
|
||||
QDeclarativeEngine engine;
|
||||
|
||||
QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("startOnCompleted.qml")));
|
||||
QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
|
||||
QVERIFY(rect != 0);
|
||||
|
||||
QQuickItem *innerRect = rect->findChild<QQuickRectangle*>();
|
||||
QVERIFY(innerRect != 0);
|
||||
|
||||
QCOMPARE(innerRect->property("x").toInt(), int(0));
|
||||
|
||||
QTRY_COMPARE(innerRect->property("x").toInt(), int(100));
|
||||
|
||||
delete rect;
|
||||
}
|
||||
|
||||
QTEST_MAIN(tst_qdeclarativebehaviors)
|
||||
|
||||
#include "tst_qdeclarativebehaviors.moc"
|
||||
|
|
Loading…
Reference in New Issue