To be frank it's been an annoyance for me that gadgets can't be
instantiated the same way the QObject can within the QML document/tree.
Is there a good reason to disallow this or is it simply not implemented?
Am I missing some odd use/corner case why it's not a good idea?
It's not implemented yet, and there are some questions surrounding the
desired syntax.
We already have group properties. So, if you have a property font of
some value type, you can already do this:
MyObject {
font {
pointSize: 14
bold: true
}
}
That is very similar in syntax to what you would do with a full value
type construction. Therefore, the extra syntax required for full value
type construction seems some
what redundant. I've chosen the familiar "font" value type as example
but you can do the same with custom value types.
What is missing is value types as default properties and value types in
lists and JavaScript objects. Yet, declaratively putting QML types in
lists and objects is already a rather buggy affair with object types.
This needs to be fixed first.
Then there is the issue that you cannot have named custom value types at
all so far (you can have anonymous custom value types, though). All of
the currently available named value types are hardcoded. That has to be
fixed eventually.
Finally, we will probably run into some grammatical ambiguities when we
allow lower-case names on the left side of "object" intializers.
best regards,
Ulf
_______________________________________________
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest