[solved]QML element scope
-
I have a QML element in main.qml. And the it has children elements and each children elements has it children elements. My question is:
- Can grand children use its grand parents id to call its properties or send signal by connection?
- Can grand parent use its grand children id to call its properties or send signal by connection?
- Can any grand children communicate each other by use its id to call its properties or send signal by connection?
any example for each case?
-
Yes this is possible. I think the only thing that is restricted to siblings or immediate parent/child relationships are anchors - and this is only for performance reasons.
-
Is this true for multiple QML files project?
-
Items in external component files are limited in scope to their own file. If you wish to expose properties of internal items in a component then you need to define alias properties in the top-level item of the component. See this "article":http://developer.qt.nokia.com/wiki/QML_Progress_Spinner for an example.