Hello smart people!

I have a simple app that displays database rows in a QTableView, using a derived QSqlTableModel. One column of the dataset is editable - a simple checkbox - and to achive this I have redefined data and setData methods with Qt::CheckStateRole.

All works ok, but there's an annoying problem with the tableView. If I select a row and then call select(), the row selection is cleared model is reset.

So, if I update the checkbox on one of the rows - this will trigger a select() - my selection is gone and the view whizzes back to the first row!

Can anyone explain why it's doing this and how to prevent it?

Thanks!

Will