[Qt-qml] running script at item load
michael.brasser at nokia.com
michael.brasser at nokia.com
Fri Aug 13 07:59:13 CEST 2010
On 13/08/2010, at 3:38 PM, ext tapani.mikola at nokia.com<mailto:tapani.mikola at nokia.com> wrote:
On 08/13/2010 04:31 AM, Brasser Michael (Nokia-MS-Qt/Brisbane) wrote:
note that there aren't any Item-level notifications for this type of thing from QML, only Component-level
Component.onCompleted works for any QML Item.
e.g.
import Qt 4.7
Rectangle {
width: 200
height: 200
Text {
x: 66
y: 93
text: "Hello World"
Component.onCompleted: console.log ("Hello World completed!")
}
Component.onCompleted: console.log ("App completed")
}
outputs:
App completed
Hello World completed!
- Tapani
P.S: in this particular case I find the ordering a bit strange
To (hopefully) clarify, Component.onCompleted can be attached to any object, but it only reports on component completion -- for the example above both are triggered at the same time when the entire component has finished being created/initiialized. Within a component, they are run in an 'undefined' order.
Regards,
Michael
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt.nokia.com/pipermail/qt-qml/attachments/20100813/4e6acb16/attachment.html
More information about the Qt-qml
mailing list