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

QSortFilterProxyModel broken when adding columns

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: P2: Important
    • Resolution: Unresolved
    • Affects Version/s: 5.9, 5.12.0
    • Fix Version/s: None
    • Component/s: Core: Item Models
    • Labels:
      None
    • Environment:
      Windows 10, Qt 5.12 and Qt 5.9.3, but also observed in many other versions
    • Platform/s:
      All

      Description

      My example is the standard Qt example from here: http://doc.qt.io/qt-5/qtwidgets-itemviews-editabletreemodel-example.html
      It is also delivered with every qt installation, e.g. C:\Qt\Qt5.12.0\Examples\Qt-5.12.0\widgets\itemviews\editabletreemodel

      When just executed, it works fine, but now lets insert a QSortFilterProxyModel, just to make it sortable. We change the MainWindow c'tor to
      ...

      QFile file(":/default.txt");

      file.open(QIODevice::ReadOnly);

      TreeModel* model = new TreeModel(headers, file.readAll());

      file.close();

      QSortFilterProxyModel* sort = new QSortFilterProxyModel( this );

      sort->setSourceModel( model );

      view->setModel( sort );

      ...

      Now execute the example, expand one or two of the root nodes and select the menu entry "insert column" you will see, that only the root nodes have a new column, all their children do not have the new column. It works without the proxy.

      Adjusting the example by emitting begin/end inster columns for every parent node will fix this bug at first glance. But further working with the example showas strange behaviour, so the model seems to be still broken.

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

              Dates

              Created:
              Updated:

                Gerrit Reviews

                There are no open Gerrit changes