[PyQt] Fast selection of non-contiguous items in QTreeview

Darryl Wallace darryl.wallace at prosensus.ca
Thu Apr 8 19:23:09 BST 2010


Hello,



I’ve done some reading and can’t find anything on non-contiguous selection
of items in item views beyond :



“Selections are made up of *selection ranges*. These efficiently maintain
information about large selections of items by recording only the starting
and ending model indexes for each range of selected items. Non-contiguous
selections of items are constructed by using more than one selection range
to describe the selection.” -
http://doc.trolltech.com/4.6/model-view-selection.html#concepts



Currently we have implemented a selection of items by scanning each row in
the model to see if it should be “selected” based on certain criteria.  Is
there a faster way to do this as looping in Python through a large (50,000
rows)?  When selections can be specified with selection ranges the selection
is fast.  However, our worst case scenario is that every-other item need be
selected: 25,000 selection ranges would be created and then we would just be
looping through everything again anyways.



Any ideas?



Thanks,

Darryl
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20100408/42203474/attachment.html>


More information about the PyQt mailing list