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

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

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Not Evaluated
    • Resolution: Duplicate
    • Affects Version/s: 5.11.0
    • Fix Version/s: None
    • Component/s: Core: Item Models
    • Labels:
      None
    • Platform/s:
      Windows

      Description

      	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

        Attachments

          Issue Links

          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:
                ziv x x
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Gerrit Reviews

                  There are no open Gerrit changes