0

I have a QTableView with around 10k entries. When I call QAbstractItemView::selectAll it takes about 5secs to complete. The performance otherwise is OK.

  1. Why is the selection so slow?
  2. and is there something I can do to speed it up?
Horst Walter
  • 13,663
  • 32
  • 126
  • 228
  • 1
    I think it is something that has to do with your model, I've just ran [this](http://pastebin.com/8TzhyYin) on Qt 5.6.1, and `selectAll()` took 1 milli second here. – Mike Aug 06 '16 at 01:56
  • 1
    Is there a difference if you already have any items selected or not? – jonspaceharper Aug 06 '16 at 03:07
  • 2
    Try running your test inside a profiler (if you're on a Mac, Apple's "Instruments" program works very well, or Activity Monitor's "Sample Process" feature will do in a pinch). That will show you where your program is spending its time during those 5 seconds. – Jeremy Friesner Aug 06 '16 at 04:10
  • @Mike I also think it is model related, only I do not see how. I wonder what the relation is. Have to check if `data()` or something else is called for all items. @Jon No obvious difference if items are already selected Guess I really have to use a profiler – Horst Walter Aug 06 '16 at 10:16
  • 1) Always profile. 2) I was curious if a hunch about `QItemSelection` would bear out. – jonspaceharper Aug 06 '16 at 11:13

0 Answers0