Details
-
Task
-
Resolution: Unresolved
-
P2: Important
-
None
-
None
-
None
Description
So far gadgets are very different from QObjects: they can only originate as property values or signal parameters or events coming from other objects that have already been instantiated, and they only ever exist on the stack. That's occasionally useful; but I think it might provide a means to make much more lightweight objects if it were also possible to declare gadget instances, just like declaring QObject subclass instances (Items and so on).
The next thing that is limiting is that gadgets can't have signals. Not sure if that can ever be mitigated in some way. So e.g. Event Handlers can't be gadgets currently, because they would be mostly useless without signals.
So it needs more thought: what would be the best use cases? If declared instances won't be useful, because they can't have signals or because they shouldn't be heap-allocated or something else, would it be enough to be able to instantiate them via JS, so they can be used as messenger objects?
Attachments
Issue Links
- is required for
-
QTBUG-79330 Improve handling of Q_GADGETs in QML
- Open
- relates to
-
QTBUG-54321 Is it really impossible to pass a Q_GADGET by pointer to QML?
- Reported
-
QTBUG-73399 Make it possible to use containered Q_GADGETS in QML
- Closed
-
QTBUG-82443 Value types and Containers in QML
- Closed
-
QTBUG-54983 Create Q_GADGET objects in QML
- Closed
-
QTBUG-56484 Definition of gadgets in QML
- Open
-
QTBUG-54983 Create Q_GADGET objects in QML
- Closed