Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
QTableView, set arbitrary selection of rows.
Jeroen3 last edited by Jeroen3
I'm using a QTableView with a custom model. I want to change the arbitrary selection of rows after a manipulation of the model data.
So first row 1,5,8 are selected, then the data of these rows are moved upwards in the vector, and the selection should also move upwards, to 0,4 and 7. But there seems no method for setting a selection in a QTableView. Am I missing something?
Jeroen3 last edited by
Well. I got it. It think. Almost all roads are a dead end for requiring a QModelIndex (which you cannot create from a Row/Col), or bump into a protected method.
The most obvious solution is using, QTableView::setSelection. But it's protected.
So you cannot access that from your model, or from the QMainWindow.
But there seems to be this way: