In this case, leave the selection mode for the table set to single cell selection. That will accomplish the 1 <-> 1 connection mode. Then, connect a slot to the row header's QHeaderView::sectionClicked() signal. In your slot, manually select all of the cells in the row. Do this by retrieving the selection model for the table (QTableView::selectionModel()), then create a QItemSelectionthat contains QModelIndex entries for all of the cells in the row, and finally calling QItemSelectionModel::select() with this QItemSelection. Calling select() will result in the selectionChanged() signal being emitted by the QItemSelectionModel, so you should be able to use the same slot to handle this as you do the single cell select.Yes, but now I cannot select a single cell.
Note that you can't simply call QTableView::selectRow() because your selection mode allows only single cell selection.




Reply With Quote

Bookmarks