[PyQt] Selecting several table items

Mark Summerfield list at qtrac.plus.com
Thu Aug 20 19:23:58 BST 2009


On 2009-08-20, Mads Ipsen wrote:
> Hi,
>
> Ho do I programmatically select several items in a QTableView? I can
> select one element by calling the method setCurrentIndex(), but that
> only selects a single item. I need to do this in order to write a proper
> unit test.
>
> Best regards,
>
> Mads

Hi Mads,

All Q*View widgets have a selectionModel() method that returns a
_view_-specific QItemSelectionModel. You can use this to perform complex
selections programmatically.

-- 
Mark Summerfield, Qtrac Ltd, www.qtrac.eu
    C++, Python, Qt, PyQt - training and consultancy
        "Programming in Python 3" - ISBN 0137129297




More information about the PyQt mailing list