Hello,
How do I select a cell in a QTableView?
The only thing I can find is QTableView::setSelection () but it requires a QRect.
I like to specify row and column coordinates, how is that done?
Hello,
How do I select a cell in a QTableView?
The only thing I can find is QTableView::setSelection () but it requires a QRect.
I like to specify row and column coordinates, how is that done?
Hello,
Take a look at QItemSelectionModel which is accessible via QAbstractItemView::selectionModel().
J-P Nurmi
Thanks jpn;
However that function takes a QModelIndex as parm. And that bugger does not have a constructor to feed row and column into.
QModelIndex represents a location in the model. See QAbstractItemModel::index():
Qt Code:
To copy to clipboard, switch view to plain text mode
J-P Nurmi
JeanC (6th February 2008)
Sorry, It seems I asked the wrong question.
This function indeed selects the cell. Good to know because it wasn't obvious to me.
But I'm searching for the function to set that cell as the current, so when the arrow keys are pushed, the adjacent cell becomes the current.
Ok, then it's QAbstractItemView::setCurrentIndex()
J-P Nurmi
Dutchman (25th January 2012)
Thanks again. Great help here.
Bookmarks