On Fri, 2014-01-03 at 07:23 -0800, Jason H wrote: > I have a structured QML document that is nothing more than Items and > Images. Some Images are collected into an Item and an id is assigned. > > > > > > Structure1.qml > Item { > id:item > Image { id: image1} > Image { id: image2} > > } > > > I then inherit this structure, and set the additional info at runtime: > CompleteObject1.qml > Structure { > Component.onCompleted: { > image1.source = "image1.png" > image2.source = "image2.png" > } > > } > > > But when I load CompleteObject.qml it says "image1 not defined" > How can I expose the Structure ids to the CompleteObject? > > > (The structure and objects are functionally independent, except that > they have matching IDs, such that StructureN intersects > CompleteObjectN makes an instance ) >
Hi, You cannot access component's internals directly, but you can expose them as properties: Structure.qml: Item { id: item // give access to the whole Image element property alias imageItem: myImage // alternatively, just expose the source property alias iconSource: myImage.source Image { id: myImage } } CompleteObject.qml: Structure { iconSource: "foo.png" Component.onCompleted: imageItem.foo = bar } -- J-P Nurmi _______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest