Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-72223

Make it possible to declare Q_GADGET instances in QML

    XMLWordPrintable

Details

    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

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              qt.team.quick.subscriptions Qt Quick and Widgets Team
              srutledg Shawn Rutledge
              Votes:
              4 Vote for this issue
              Watchers:
              9 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes