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

Model/View Framework: Add a tree flattening model

    XMLWordPrintable

Details

    • User Story
    • Resolution: Unresolved
    • Not Evaluated
    • None
    • None
    • Core: Item Models
    • None

    Description

      I would like to achieve something like this in my project:

       

      https://stackoverflow.com/questions/3384005/qt-table-and-tree-view-with-the-same-model

       

      It seems that QSortFilterProxtModel does not offer this directly because:

       

      Currently, you need to set recursiveFilteringEnabled to true because:

      > This property holds whether the filter to be applied recursively on children

      Otherwise, the leaf nodes will not be checked, or any embedded branch node. But the problem is then this:

      > and for any matching child, its parents will be visible as well.

      I would not like to have the parents visible, only the leaf like in the above Stack Overflow question.

       

      There are some existing implementations that could be source of inspiration for a public API:

       

      KDescendantsProxyModel

      https://api.kde.org/frameworks/kitemmodels/html/classKDescendantsProxyModel.html

       

      QQmlTreeModelToTableModel

      https://github.com/qt/qtdeclarative/blob/dev/src/qmlmodels/qqmltreemodeltotablemodel.cpp

       

      It is not an option for us to depend on Qml (QtDeclarative) or KDE (KItemModels).

       

      Then, there is us, and there is also the StackOver flow question, so at least four different places where this has been needed. I believe it would make sense to have some public model for this in Qt itself, agnostic of Qml as we have been developing a widget-based application. I am probably biased, but a few use cases seem to justify not reinventing it elsewhere (Qml, KDE, StackOverflow, me, etc).

       

      Any thoughts?

       

      richard 

      Attachments

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

        Activity

          People

            dfaure_kdab David Faure
            lpapp Laszlo Papp
            Votes:
            2 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There is 1 open Gerrit change