Hi Simon,
I am not sure this is quite what you mean, but have you looked at both
examples/declarative/ui-components/tabwidget
and
examples/declarative/modelviews/parallax ?
Both of these examples do clever things with the 'default property...' that I
think do what you are after. QML already has inheritance. For example I can use
both of the above examples without cut and pasting any code just by using the
TabWidget { my QML here } or ParallaxView { my QML here }. You still have
access to all the properties defined in the root of the TabWidget and
ParallaxView files. If you wanted to subclass them without cut and paste and
allow them to be reusable you can do this.
Create a file called MyTabWidget.qml
In the root have the TabWidget as the root item
Import Qt Quick 1.0
TabWidget {
Put your QML custom code here
}
You can then start reusing MyTabWidget {} in your QML app.
- Nigel
Br, Nigel
Hi all,
Is there a way of creating reusable components within QML where those
components might be further customized by the developer without cut-and-paste
of the original code? The particular use case that I am imagining is a
slide-out ‘drawer’ component where the drawer contents might differ.
Two possibilities spring to mind:
1) A ‘delegate’ property type to which could be assigned another component
that was responsible for drawing within the parent or within a designated area.
2) An inheritance mechanism.
Have others been thinking about this need? Is this too much to expect from QML
and so a point where one would drop to C++ and create a new component there?
Regards,
Simon
<ATT00001..txt>
_______________________________________________
Qt-qml mailing list
[email protected]
http://lists.trolltech.com/mailman/listinfo/qt-qml