Details
-
Suggestion
-
Resolution: Fixed
-
P2: Important
-
5.7.0
-
None
-
e9f650cad82e7eff2234cdf2d37bb9b1bb25d27d
Description
It will be nice if we can create Q_GADGET objects in QML not only to use them.
I'll paste Simon's reply here:
No objection per-se, but we'd have to figure out some details. For example declarative instantiation is not an object, as the ownership rules do not comply with QObject. That would leave us with a JavaScript
constructor function, replacing Qt.point(...) for example. But then we'd have to comply with the namespace rules, so we'd haveqmlRegisterGadget<MyGadget>("MyModule", "ThatName", 1, 0);and then
import MyModule 1.0
and in expressions we'd have
var g = new ThatName();and the same for a namespaced import:
import MyModule 1.0 as Foo var g = new Foo.ThatName();It's a bit of work to do, but I don't see a problem in principle.
I'm adding also :
import MyModule 1.0 as Foo
property Foo.ThatName name
Attachments
Issue Links
- duplicates
-
QTBUG-77333 Q_GADGET is incompatible with QQuickItem
- Closed
- is required for
-
QTBUG-79330 Improve handling of Q_GADGETs in QML
- Open
- relates to
-
QTBUG-72223 Make it possible to declare Q_GADGET instances in QML
- Open
-
QTBUG-73399 Make it possible to use containered Q_GADGETS in QML
- Closed
-
QTBUG-79640 Q_GADGETs can't be used as Pointers in QML
- Closed
-
QTBUG-82443 Value types and Containers in QML
- Closed
-
QTBUG-54321 Is it really impossible to pass a Q_GADGET by pointer to QML?
- Reported
-
QTBUG-72223 Make it possible to declare Q_GADGET instances in QML
- Open
-
QTBUG-56484 Definition of gadgets in QML
- Open