There is much better solution:
/* MyObject.qml */
Rectangle {
default property alias data /* name can be any */ : inner_space.data
/* ... You can put other elements here ... */
Item {
id: inner_space
/* ... Params ... */
}
/* ... You can put other elements here ... */
}
And now we can do all we want!
/* main.qml */
Rectangle {
MyObject {
Button {
/* ... */
}
}
}
Thanks to user bobbaluba for suggesting to use the data
property rather than children
.