Hi,
```
Flickable {
id: root
// ...
property Component defaultScrollBar: Component {
ScrollBar { }
}
ScrollBar.vertical: {
if (condition && root.defaultScrollBar) {
return root.defaultScrollBar.createObject() // a parent is not
passed on purpose
}
return null
}
```
This works in the sense that your ScrollBar object is garbage-collected
when overridden. This is because the ScrollBar attached object
un-parents it in that case and the QML engine doesn't consider it
undeletable. However, if you create a new Component object in every
derived type you probably haven't saved a lot of memory (but I haven't
measured it).
What we should actually do is expose deferred properties to QML. In C++
you can already have deferred properties, like the background of Label.
The default values for those are only created if they haven't been
overridden.
best,
Ulf
_______________________________________________
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest