Select row in QTableView after insert.
Hello,
I would like to select a row in the a tableview after inserting it. I'm inserting the row as the last in the model, using QSqlTableModel.insertRow(QSqlTableModel.rowCount() ). I want to select the inserted row in a QTableView which uses this model.
My problem is I cannot find which row in the table view corresponds to the new row in the model. Or, in other words: given a row in the model, how can I know the row where it's displayed in the table?
Thanks !
Re: Select row in QTableView after insert.
Sorry... should have looked around further: the answer is here
Since I also have a QSortFilterProxyModel between the model and the view, I had to use QSortFilterProxyModel.mapFromSource to convert the model index to the filter proxy's index (the table view has the filter proxy set as it's model).