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

Qt 5.3.1 introduced issue with QSqlTableModel and QSortFilterProxyModel

    XMLWordPrintable

Details

    • Bug
    • Resolution: Cannot Reproduce
    • P3: Somewhat important
    • None
    • 5.3.1, 5.3.2
    • SQL Support
    • None
    • Win7 x64, VS2013, MySQL 5.6

    Description

      One of my GUI panels uses a QTreeView attached to a QSortFilterProxyModel attached to a QSqlTableModel. The SQL model is assigned to a database table with about 60000 rows and 6 common columns.

      Using Qt5.3.0 data loading was simple... it needed a few seconds to load the data (used task manager as network traffic monitor) and another second to display the data in the QTreeView.

      Using Qt5.3.1 that became pain... it still needs a few seconds to load the data but then it blocks an entire CPU core for multiple minutes (making the application unresponsive) before data finally appears in the view.

      This problem does not appear using custom models (derived from abstract table model) with similar row counts.

      I also tried the same with a non-derived QSqlTableModel and a default constructed QSortFilterProxyModel (which means no filtering takes place at all)... still loading needs mutiple minutes. This is the code I use:

          sqlTableModel = new QSqlTableModel(nullptr, QSqlDatabase::database(connectionName));
          
          proxyModel = new QSortFilterProxyModel();
          proxyModel->setSourceModel(sqlTableModel);
          
          tableView = new QTableView();
          tableView->setSortingEnabled(true);
          tableView->setModel(proxyModel);
          
          sqlTableModel->database().open();
          sqlTableModel->setTable("table_name");
          sqlTableModel->select();
      

      I also tried Qt5.3.2 and it didn't fix the problem.

      Attachments

        1. main.cpp
          0.9 kB
        2. sqllite.zip
          3.32 MB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            mabrand Mark Brand
            silicomancer Bernhard Lindner
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes