Thanks for the advice, Adriano I didn't check if exposing children works, but probably it does and this makes more sense. Will give it a try in the next project where such variation is needed.
Best regards, Artem. On Jun 20, 2011, at 8:03 PM, Adriano Rezende wrote: > On Tue, Jun 14, 2011 at 4:07 PM, Artem Marchenko <[email protected]> > wrote: > Hi > > I didn't try this code, but in general it should work. > > Yes, it works. But I want a guarantee that it won't change in the future due > to an internal change in the QML code. > > What I did try is to defined some parts of a scene in the descendant object > (like you would do in a Strategy pattern for coding) and reparenting works > very well there, even anchors are accounted correctly. For example, in my > cross-platform app I need to draw status line on Symbian only: > > BaseUi.qml > Rectangle { > > // to be filled for platforms that need it > property alias statusLine: mainPane.statusLine > > // needs to be exposed so that I could parent to it > property alias mainPane: mainPane > > Rectangle { > id: mainPane > property variant statusLine: null > } > } > > SymbianUi.qml > > BaseUi { > statusLine: Rectangle { > parent: mainPane > anchors.left: parent.left // yep, this also works > } > } > > > In your case I think it's better to use children property, so you don't need > to expose the parent. It could be like below: > > BaseUi.qml > === > Rectangle { > property alias statusLine: mainPane.children > > Rectangle { > id: mainPane > anchors.fill: parent > anchors.margins: 10 > } > } > > > SymbianUi.qml > === > BaseUi { > statusLine: Rectangle { > anchors.fill: parent > } > } > > Br, > Adriano >
_______________________________________________ Qt-qml mailing list [email protected] http://lists.qt.nokia.com/mailman/listinfo/qt-qml
