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

QSortFilterProxyModel broken when adding columns

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P2: Important P2: Important
    • None
    • 5.9, 5.12.0
    • Core: Item Models
    • None
    • Windows 10, Qt 5.12 and Qt 5.9.3, but also observed in many other versions
    • All

      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.

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

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

              Created:
              Updated:

                There are no open Gerrit changes