Placing child elements in a component
-
Is there some way in a component to specify where should the child items be placed?
I mean something like:
main.qml:
@import Qt 4.7MyComponent {
Image { id: coolpic; source: "pic.jpg" }
}@MyComponent.qml:
@import Qt 4.7Rectangle {
border.color: "black"Rectangle { color: "white" anchors.margins: 3 // placeholder for the children (e.g. the coolpic Image element) } // some other items here
}@
-
try this
@
import Qt 4.7default property alias content: content.children
Rectangle {
border.color: "black"Rectangle { id: content color: "white" anchors.margins: 3 // placeholder for the children (e.g. the coolpic Image element) } // some other items here
}
@