[Qt-qml] Reparent in object initialization

Adriano Rezende adriano.rezende at openbossa.org
Tue Jun 14 15:54:03 CEST 2011


Hi,

Is that ok to set the parent of an object during the property
initialization?

For example:

// Foo.qml
Item {
    property alias container: frame

    Item {
        id: frame
        anchors.fill: parent
    }

    Rectangle {
        anchors.fill: parent
        color: "red"
        opacity: 0.5
    }
}

// main.qml
Foo {
    id: foo
    Rectangle {
        parent: foo.container
        color: "blue"
    }
}


QML would guarantee that the property would not be overwritten by the
initial parent?


Br,
Adriano
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt.nokia.com/pipermail/qt-qml/attachments/20110614/c005a818/attachment.html 


More information about the Qt-qml mailing list