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

Very slow QTableView selection for many rows (10000+)

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: P3: Somewhat important
    • Resolution: Unresolved
    • Affects Version/s: 4.8.6, 5.7.0
    • Fix Version/s: None
    • Component/s: Widgets: Itemviews
    • Labels:
      None
    • Environment:
      Windows 7, 64 bit
    • Sprint:
      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

        For Gerrit Dashboard: QTBUG-59478
        # Subject Branch Project Status CR V

          Activity

            People

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

              Dates

              Created:
              Updated:

                Gerrit Reviews

                There is 1 open Gerrit change