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

Proxy models maintaining the tree structure are impossible

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 6.2.0 Alpha
    • 5.14.2
    • Core: Item Models
    • None
    • All
    • 3c74ee568289af7500f165c4d29f380eefa1f4b9 (qt/qtbase/dev)

    Description

      At the moment, implementing a custom proxy model that does not change the parent-child relationship of the source model requires to build an entire 1-to-1 mirror of parent-child relationships of the source model.

      QIdentityProxyModel and QTransposeProxyModel go around this limitation by adding themselves as friends of QAbstractItemModel and calling the source model's createIndex()

      "Hacking" access to protected methods should not be the solution, QAbstractItemModel should allow proxy models to indirectly use sourceModel()->createIndex

      Unfortunately do to the lockdown I don't have access to a dev machine set up to submit patches to Qt directly, as a second best I attach a patch to the current dev branch that implements a solution.

      Attachments

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

        Activity

          People

            dfaure_kdab David Faure
            VRonin Luca
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes