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

Proxy models maintaining the tree structure are impossible

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: P2: Important
    • Resolution: Unresolved
    • Affects Version/s: 5.14.2
    • Fix Version/s: None
    • Component/s: Core: Item Models
    • Labels:
      None
    • Platform/s:
      All

      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

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

          Activity

            People

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

              Dates

              Created:
              Updated:

                Gerrit Reviews

                There are no open Gerrit changes