[Interest] QML "container" inheritience and sharing IDs
Jason H
scorp1us at yahoo.com
Fri Jan 3 17:30:42 CET 2014
Thanks! This works!
What happens if I want to add a level between the two levels?
Do I realias the properties?
Between.qml:
{
property alias exportedAliasId: importedAliasId
}
There is nothing else I need to do?
________________________________
From: Nurmi J-P <jpnurmi at digia.com>
To: "scorp1us at yahoo.com" <scorp1us at yahoo.com>
Cc: "interest at qt-project.org" <interest at qt-project.org>
Sent: Friday, January 3, 2014 10:33 AM
Subject: Re: [Interest] QML "container" inheritience and sharing IDs
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20140103/d32987e0/attachment.html>
More information about the Interest
mailing list