[PyQt] Slow selection

Mads Ipsen mads.ipsen at gmail.com
Tue Apr 22 07:02:44 BST 2014



On 21/04/14 23:30, Virgil Dupras wrote:
> On Mon, Apr 21, 2014, at 06:31 PM, Mads Ipsen wrote:
>> Hi,
>>
>> I have been having some performance issues with large tables and
>> selection. I use table views to display coordinates of individual
>> atoms in very large molecules (> 25000). Selection of atoms can be
>> controlled by the user by
>>
>> * Interacting with the table view through mouse selection, keyboard
>>   selection.
>>
>> * Interacting with an OpenGL window. In this case, the update of the
>>   QItemSelectionModel is done programatically.
>>
>> Even for very large systems, this performs very well.
>>
>> However, if sorting and filtering is needed, a QSortFilterProxyModel
>> must be employed.  Mouse and keyboard interaction with the table view
>> is still snappy, whereas programmatic updates seems to slow things
>> down to a halt.
>>
>> I have attached a simple table example with 10000 rows. The employed
>> proxy model is just the Qt base class with no added functionality. If
>> you press 'Esc' (deselect) or 'Ctrl+A' (select all) everything is
>> fast.
>>
>> If you press the bottom 'Select top half', the top half table rows are
>> selected using one single QItemSelection spanning the row range
>> 0:n/2. In this case the GUI becomes almost unresponsive, and
>> scrolling, resizing, etc. is slow.
>>
>> Any clues?
>>
>> Best regards,
>>
>> Mads
> 
> Maybe not a definitive answer, but you might have a clue at
> http://stackoverflow.com/questions/841096/slow-selection-in-qtreeview-why
> .
> 

Thanks - and yes, I saw that one. It doesn't help.

What I really would like to clarify is if my code example is flawed (bad
usage of the selection framework).

Best,

Mads

-- 
+---------------------------------------------------------+
| Mads Ipsen                                              |
+----------------------+----------------------------------+
| Gåsebæksvej 7, 4. tv | phone:              +45-29716388 |
| DK-2500 Valby        | email:      mads.ipsen at gmail.com |
| Denmark              | map  :   www.tinyurl.com/ns52fpa |
+----------------------+----------------------------------+


More information about the PyQt mailing list