[Qt-qml] running script at item load

tapani.mikola at nokia.com tapani.mikola at nokia.com
Fri Aug 13 07:38:06 CEST 2010


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt.nokia.com/pipermail/qt-qml/attachments/20100813/36e23383/attachment.html 


More information about the Qt-qml mailing list