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

QSortFilterProxyModel::setSourceModel reverts to empty static model if old model is deleted

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Not Evaluated Not Evaluated
    • None
    • 5.11.0
    • Core: Item Models
    • None
    • Windows

      	auto oldModel = new QStandardItemModel(10, 10);
      
      	auto newModel = new QStandardItemModel(20, 20);
      
      	auto proxy = new QSortFilterProxyModel;
      	proxy->setSourceModel(oldModel);
      
      	QCOMPARE(proxy->rowCount(), 10);
      
      	proxy->setSourceModel(newModel);
      	QCOMPARE(proxy->rowCount(), 20);
      	delete oldModel;
      	QCOMPARE(proxy->rowCount(), 20);
      

      last rowCount returns 0

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

            dfaure_kdab David Faure
            ziv x x
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes