[Qt-qml] How QML file is parsed and linked and executed?
ext-ivailo.iliev at nokia.com
ext-ivailo.iliev at nokia.com
Wed Nov 24 09:47:58 CET 2010
Hello,
as I got this is how it works now. The first one is the parent onCompleted and then we have all the child events poped up from the tail somehow.
though it looks strange - in the "normal" HTML / Js or WEB in general you shall expect them to be fom top-to-bottom, or in a complete mess. So this queue pop-up behaviour is a little strange.
But if this is how it should be it's ok for me at least - if I know how it should work I could structure my stuff for it.
But if it's still in progress of development and if you could think of another approach I think many people will like to see the other behaviour - form top to bottom. So to make it more clear the "better" result from this example for us will be:
one
two
three
screen
I know that this is structurally incorrect for you, as you cannot start invoking events before you have full initialization, but if you can reverse the stack with events and call them in this way it will be great :-P
best regards,
Ivo
________________________________________
From: Pasion Jerome (Nokia-MS-Qt/Oslo)
Sent: Tuesday, November 23, 2010 9:29 PM
To: Iliev Ivailo (EXT-ProData/Berlin); Kennedy Aaron (Nokia-MS-Qt/Brisbane)
Cc: qt-qml at trolltech.com
Subject: RE: [Qt-qml] How QML file is parsed and linked and executed?
Hello,
Example:
============================
import QtQuick 1.0
Rectangle {
id:screen; width: 100; height: 100
Rectangle {
id: one; width: 10; height: 10
Component.onCompleted: console.log("one")
}
Rectangle {
id: two; width: 10; height: 10
Component.onCompleted: console.log("two")
}
Rectangle {
id: three; width: 10; height: 10
Component.onCompleted: console.log("three")
}
Component.onCompleted: console.log("screen")
}
=================================
output:
screen
three
two
one
The top level's handler is first, then the children.
Is this a reasonable generalization to make?
Cheers,
Jerome P.
________________________________________
From: qt-qml-bounces at trolltech.com [qt-qml-bounces at trolltech.com] On Behalf Of Iliev Ivailo (EXT-ProData/Berlin)
Sent: Tuesday, November 23, 2010 9:23 AM
To: Kennedy Aaron (Nokia-MS-Qt/Brisbane)
Cc: qt-qml at trolltech.com
Subject: Re: [Qt-qml] How QML file is parsed and linked and executed?
Hi,
ok, thanks :)
best regards,
Ivo
________________________________
From: Kennedy Aaron (Nokia-MS-Qt/Brisbane)
Sent: Tuesday, November 23, 2010 3:03 AM
To: Iliev Ivailo (EXT-ProData/Berlin)
Cc: <qt-qml at trolltech.com>
Subject: Re: [Qt-qml] How QML file is parsed and linked and executed?
Hi,
As it says in the documentation, the order Component.onCompleted handlers are executed is not defined.
Roughly speaking (as there are exceptions), elements are instantiated from top to bottom, and the onCompleted signals are executed in reverse order of instantiation. But don't rely on that behaviour.
Cheers,
Aaron
On 22/11/2010, at 6:49 PM, ext ext-ivailo.iliev at nokia.com<mailto:ext-ivailo.iliev at nokia.com> wrote:
Hi,
as you all know HTML and JavaScript are executed / or evaluated / form the TOP to BOTTOM. So if you have a source of 100 lines it will start from line 1 and will finish with the last one. When you know this you can somehow figure our some tricks you want to make and know what to expect.
I have a QML file that I want to trace how it's reacting.
Rectangle {onCompleted: {console.col("m1")}}
Rectangle {onCompleted: {console.col("m2")}}
and in the console output I have m2, m1.
so does it mean that in QML we have stack popup priority of structure handling - you parse it from top to bottom and execute it form bottom to top? does it mean that my "later" element will always have Component.onCompleted "before"? Or this reverse order is just temporary or coincidence on my machine or we shall not expect any order of loading - "everything will come when it comes"?
Best Regards,
Ivo
_______________________________________________
Qt-qml mailing list
Qt-qml at trolltech.com<mailto:Qt-qml at trolltech.com>
http://lists.trolltech.com/mailman/listinfo/qt-qml
More information about the Qt-qml
mailing list