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

QQuickControl not resprecting CppOwnership

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • P2: Important
    • None
    • 5.9.4
    • Quick: Controls 2
    • None

    Description

      QQuickControl has two places ( https://code.woboq.org/qt5/qtquickcontrols2/src/quicktemplates2/qquickcontrol.cpp.html methods setContentItem_helper and setBackground ) where child item is just deleted without checking ownership. I guess there are many other places in other controls too, due to the usage of plain deletes in code. Maybe it would be better to have an helper method for unlinking control children within qquickitems in general. This method would check ownership and then either deletes or just set the pointer to nullptr.

      Background:

      Approach 1: Presenting over an Loader (working):

      • Load an QQmlComponent component in c++
      • Have an Loader component in qml
      • Bind the QQmlComponent to Loaders SourceComponent(:Component) property
      • -> Rebinding the property works and updates presentation (incubating an new delegate)

       Approach 2: Presenting over Content Presenter (not working)

      • Load an QQmlComponent component in c++
      • Incubate an QQuickItem in c++ and set Ownership to CppOwnership
      • Optional handle bindings with an QQmlContext in c++
      • Have an Control Item in qml
      • Bind the QQuickItem to Controls background(:Item) or contentItem(:Item) property
      • -> Rebinding works and updates presentation. However it deletes the old incubated QQuickItem also it should not (CppOwnership)

       

       

      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
              fs Andreas Fleischner
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes