So connect a slot to the spin box's valueChanged() signal, and use that with QItemSelectionModel::select(), converting the spin box value into a QModelIndex row value:
void MyWidget::onValueChanged( int value )
{
}
void MyWidget::onValueChanged( int value )
{
QItemSelectionModel * pSelModel = myTableView->getSelectionModel();
QAbstractItemModel * pModel = pSelModel->model();
QModelIndex selIndex = pModel->index( value, 0 );
pSelModel->select( selIndex, QItemSelectionModel::ClearAndSelect | QItemSelectionModel::Columns );
}
To copy to clipboard, switch view to plain text mode
Bookmarks