[Development] Improving QtQuick internals (was Re: QML engine changes)

Alan Alpert 416365416c at gmail.com
Fri Jun 28 09:25:34 CEST 2013


On Thu, Jun 27, 2013 at 12:47 AM, Nils Jeisecke <njeisecke at saltation.de> wrote:
> HI Alan,
>
> see the following example for a real use case. I wouldn't say this is bad QML.

I would. You have two declarations about its place in the item tree.
We could change the order of evaluation so that we evaluate "parent:
..." before the implicit "data: ..." and then it wouldn't work! And
it's bad QML if you're relying on the order statements are evaluated
in (something you shouldn't be doing in any declarative language).

> Destroying the loader's component will also destroy the component's
> myTools row, although it has been reparented to another item. For this
> use case it's just the right behavior but to be honest I've not yet
> fully understood why. There must be a visual parent and an independent
> ownership child list.

There is. The QQuickItem tree and the QObject tree are technically
separate. Usually when you assign QQuickItem parentage it also assigns
QObject parentage, but that's because of how the QML language
implicitly defines a QObject tree in a similar way to how QQuickItem
does it. Using "parent:" messes that up.

--
Alan Alpert



More information about the Development mailing list