[Interest] QML DOM question

Frank Mertens frank at cyblogic.de
Tue Jun 19 17:12:35 CEST 2012


On 06/19/2012 01:43 PM, Daniel Kreuter wrote:
> Hello,
>
> I have a question about some internals of QML. How are components
> internally stored? I have a little problem and want to understand why
> he behaves the way he does but at the moment I don't know what's going
> on. To make clear what I mean I will try to explain the situation.
>
> I have something like a PagePanel with 3 different Page items inside,
> each of these owns different components.
> Now I have a component MyComponent on page1, and another instance of
> the same component on page2.
> The one on page1 defines a seperate MouseArea to handle mouse events,
> the one on page2 doesn't. But when I click the component on page2, the
> mouse event is handled which should be handled on page1, but not on
> page2 because the component on page2 doesn't define a MouseArea.
> So can it be that internally components share common properties and
> just save the differences? So this would explain why the component on
> page2 behaves the same way as the one on page1.
>
Ah and I forget to answer the primary question. With Qt 4.x
you get a hierarchy of QGraphicsItems displayed by a QDeclarativeView
which in turn is inherited from QGraphicsView. So each Item {...} generates
a QGraphicsItem instance -- same hierachy as declared in QML.
One exception though: QtObject QML items are not part of the visual
hierarchy.

Good luck,
Frank




More information about the Interest mailing list