Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QTreeView with QSortFilterProxyModel extremly slow with many (~5000) items

QTreeView with QSortFilterProxyModel extremly slow with many (~5000) items

Scheduled Pinned Locked Moved Solved General and Desktop
qtreeviewqsortfilterproxslow
4 Posts 2 Posters 940 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    gde23
    wrote on 8 Apr 2020, 12:05 last edited by gde23 4 Aug 2020, 12:06
    #1

    Hello,

    I have a QTreeView that displays some date which is in a class derived from QAbstractItemModel.
    When displaying many items (without filter) the view was slow.
    Therefore I added

        setUniformRowHeights(true);
    

    and now it is running without unusual delay.

    However I need to filter the Items in the view.
    Therfore I've added a QSortFilterProxyModel.
    However this leads to an extremly slow view (even when filterAcceptsRow() does nothing and just returns true).

    Is there some known issue with the QSortFilterProxyModel on large (~5000 items, which is not extemly large) data, or any tricks how I can speed it up?

    1 Reply Last reply
    0
    • C Online
      C Online
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on 8 Apr 2020, 12:08 last edited by
      #2

      What Os, What Qt version, minimal example please.

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      1 Reply Last reply
      1
      • G Offline
        G Offline
        gde23
        wrote on 8 Apr 2020, 12:25 last edited by gde23 4 Aug 2020, 12:41
        #3

        @Christian-Ehrlicher
        OS: Debian 10
        QtVersion: 5.13.0

        I've just tried to generate some minimal example from the editable-treemodel example in the Qt-Examples folder, however it runs perfectly fast there also with the filter.

        So it seems the problem is somewhere else.

        Ok, I found the problem.
        Thanks for demanding a minimal example :)

        The reason was, that my columnCount() function is iterative and asking all children for their columnCount to find the max columnCount needed for the view. I will change this to some lazy evaluation then everything should be fine

        1 Reply Last reply
        0
        • C Online
          C Online
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on 8 Apr 2020, 12:46 last edited by
          #4

          @gde23 said in QTreeView with QSortFilterProxyModel extremly slow with many (~5000) items:

          Thanks for demanding a minimal example :)

          Thx for trying to create one - sadly a lot of people don't understand the demand for this but this here is a good example why it's needed :)

          Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
          Visit the Qt Academy at https://academy.qt.io/catalog

          1 Reply Last reply
          0

          2/4

          8 Apr 2020, 12:08

          • Login

          • Login or register to search.
          2 out of 4
          • First post
            2/4
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved