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

Instantiator: provide a way to set the QObject parent of the objects it creates

    XMLWordPrintable

Details

    • Task
    • Resolution: Unresolved
    • P2: Important
    • None
    • None
    • None

    Description

      So far, Instantiator sets the parent of anything it creates to itself. That's an acceptable default for memory management purposes, but it's not flexible enough. I think there should be a defaultParent property. The main use case I came up with so far is to be able to instantiate multiple PointHandlers (new in 5.10) to show feedback about multiple touchpoints: the parent of the handler should always be the Item within which it will receive events. And we did not make parent a settable property either, so far; so if it is instantiated with the wrong parent, it stays that way. It's anyway more efficient to construct it with the correct parent than to set it later, because reparenting would involve removing it from the QQuickItemPrivate::extraData::pointHandlers vector if its previous parent was an Item, and adding it to its new parent's vector. And that's why parent is so far not a settable property.

      Attachments

        Issue Links

          For Gerrit Dashboard: QTBUG-64546
          # Subject Branch Project Status CR V

          Activity

            People

              srutledg Shawn Rutledge
              srutledg Shawn Rutledge
              Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There is 1 open Gerrit change