[Qt5-feedback] [ExternalEmail] Re: Merging QDeclarative specifics into core QMetaObject

Stefan Majewsky stefan.majewsky at googlemail.com
Wed Jun 15 13:50:50 CEST 2011


On Wed, Jun 15, 2011 at 2:22 AM,  <Craig.Scott at csiro.au> wrote:
> The notion of the "default" property is already covered by the USER keyword in Q_PROPERTY. Is there any reason why QML doesn't simply use that instead of requiring a separate DefaultProperty entry in the classinfo? The relevant page on QML ("Extending QML Functionalities using C++") describes the use of the DefaultProperty entry. Reading over this again, it really does seem like an oversight that this was added instead of re-using the USER property already available in the metaobject system. I suspect that this classinfo feature could be phased out by supporting the DefaultProperty in the classinfo if it is present, but fall back to the USER property if DefaultProperty is not present. In Qt5, I'd then suggest dropping the support for DefaultProperty.

There is a difference. Consider a textbox. Like any widget (or QML
Item, for that matter), I would expect the DEFAULT property to be the
list of children widgets or items, because this is the natural choice
given QML's syntax. The USER property, on the other hand, is probably
"text", as with QLineEdit et al., since this is the main editable
property of the widget itself (as in Designer). It is also where
KConfigDialog wants to retrieve entered user data from (the other
major use of the user property, ask api.kde.org for
KConfigDialogManager for more info).

As you see, there's quite a semantical difference in USER and DEFAULT
properties: The USER property is the main feature of the user
interaction with that object, while the DEFAULT property is best used
for establishing element hierarchies (in QML).

Greetings
Stefan


More information about the Qt5-feedback mailing list