[Development] QML Component inheriting?

Mark markg85 at gmail.com
Thu Oct 4 10:36:59 CEST 2012


The principle is simple. I'd like to be able to make a base component
and create different implementations of it. What i really miss in QML
is the ability to let a component inherit functionality from another
For example the following where we have a base button with different
features depending on which one you use:

   property int someNum: 100
   ... the basics for a button.

SpecialButton inherits BaseButton
   somenum: 500
   ... A BaseButton adjusted for special cases

FancyButton inherits BaseButton
   ... Fancy button with special effects, shaders and whatever you can think of

This is obviously just an example but you get the point. What i'd
expect to happen is all property's of the BaseButton to be available
in the buttons that inherit from the base. I don't expect (or need)
more specific object orientated things like abstract, public, private
or protected things. Just having the ability to inherit from another
component would be really awesome to have and would probably benefit a
lot of users as well. Just imagine all the cases where people want to
make a custom component but keep all the properties of their base
component. Right now they have to make a bunch of property alias lines
to expose the base button functionality. That would not be needed
anymore of the above would be possible.

Is there any possibility of getting this functionality in QML 2.1 (or
3.0?) or Qt 5.1.. Are there any plans at all for something like this?

Kind regards,

More information about the Development mailing list