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

Very slow QTableView selection for many rows (10000+)

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 4.8.6, 5.7.0
    • Widgets: Itemviews
    • None
    • Windows 7, 64 bit
    • Bug Fixing Week Q2/2020

    Description

      If programmatically select not consecutive rows in a very big tableview, for example, every 2nd row, all drawing become too slow.

      The reason is that when horizontal QHeaderView is repainting the function QItemSelectionModel::isColumnSelected is called.
      The code complexity is O(N^2) (rows x joined.size() = VERY large number):
      https://github.com/qt/qtbase/blob/e400b7e326c554ccd819448866265953d2a0f24d/src/corelib/itemmodels/qitemselectionmodel.cpp#L1578

      See the difference if set horizontal header view to hidden:
      all is done in a fraction of a second instead of seconds.

      The current workaround is to draw custom header without the N^2 code above.

      Attachments

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

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            trig-ger Andrey M. Tokarev
            Votes:
            7 Vote for this issue
            Watchers:
            8 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes