[PyQt] Scripted selection of items in QTableView

Saeed Bakhshmand saeedbakhshmand at gmail.com
Tue Aug 2 20:25:25 BST 2016


Hello Experts,

Here is a part of my code:
b= qt.QTableView()
model = qt.QStandardItemModel()
b.setModel(model)
# ....set up of table with importing data for the items of the model

I easily can access to the indices of the manually selected (clicked) items
by sel_mode = b.selectionModel() and sel_mode.selectedIndexes().
I am wondering if I can somehow import a default set of selected items in
the table using a python command? In this way a group of per-determined
cells in the table will be selected prior to user's interactions.
b.setSelection() seems the right choice but I am not sure. Would appreciate
any hints.

Regards,
Saeed
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20160802/ab01d755/attachment.html>


More information about the PyQt mailing list