[Interest] How to provide a component to a QML item?
Yasser Sobhy
yasser.sobhy.net at gmail.com
Tue Dec 20 02:16:27 CET 2016
Hi Jason
I am not sure if I have understood you correctly, but I think I have used a
similar approach in some of my apps to create a dynamic-content list.
I have done that by aliasing the data property of the column item as
follows
//StandardScreenWithSpecificContent.qml
StandardScreenWithSpecificContent {
property alias elements : column1.data
/* implied StandardScreenContent */
Column {
id: column1
}
}
This way you can dynamically change the children items of the column by
assigning an array of items
StandardScreenWithSpecificContent {
elements : [
Label {
text: "label 1"
},
Label {
text: "label 2"
}
]
}
On Dec 20, 2016 3:30 AM, "Jason H" <jhihn at gmx.com> wrote:
I've got a situation where I have a variety of items ("screens" in a
stackView) where they have a similar structure, but the content differs.
Example:
Screen {
Column {
StandardScreenContent { }
ScreenSpecificContent{ }
}
}
But I'd like to do it like:
StandardScreenWithSpecificContent {
/* implied StandardScreenContent */
delegate: {
Column {
/* screen specific content*/
}
}
}
This is a limited example, so it may not make a lot of sense in this
context but I think that illustrates my intent. How can I accomplish it?
_______________________________________________
Interest mailing list
Interest at qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20161220/942f908c/attachment.html>
More information about the Interest
mailing list