On 2022 Jan 6, at 10:35, Ulf Hermann 
<ulf.herm...@qt.io<mailto:ulf.herm...@qt.io>> wrote:

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.

It’s good to hear that there might be hope still.  I was assuming we won't 
because it’s a value type, can be stack-allocated, cannot be passed by pointer, 
and needs to be copied or moved every time, i.e. even after instantiating 
declaratively, you’d have to move or copy at least once to put it into a 
destination, whatever that is.

https://bugreports.qt.io/issues/?jql=text%20~%20%22gadget%20qml%22<https://bugreports.qt.io/issues/?jql=text%20~%20"gadget%20qml";>
 finds a bunch of related requests like 
QTBUG-54983<https://bugreports.qt.io/browse/QTBUG-54983> 
QTBUG-79330<https://bugreports.qt.io/browse/QTBUG-79330> 
QTBUG-56484<https://bugreports.qt.io/browse/QTBUG-56484> 
QTBUG-72223<https://bugreports.qt.io/browse/QTBUG-72223> 
QTBUG-73399<https://bugreports.qt.io/browse/QTBUG-73399>
_______________________________________________
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest

Reply via email to