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,

Solved this one by doing somthing along the lines:

selection_model = table.selectionModel()
selection_model.clearSelection()

index = model.index(0,0)
selection_model.select(index, QtGui.QItemSelectionModel.Select)

index = model.index(1,0)
selection_model.select(index, QtGui.QItemSelectionModel.Select)

Sorry for bothering you with this,

Mads

--
+------------------------------------------------------------+
| Mads Ipsen, Scientific developer                           |
+------------------------------+-----------------------------+
| QuantumWise A/S              | phone:         +45-29716388 |
| Nørresøgade 27A              | www:    www.quantumwise.com |
| DK-1370 Copenhagen, Denmark  | email:  m...@quantumwise.com |
+------------------------------+-----------------------------+


_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Reply via email to