You may have to do one of two things:
- You will need to subclass
QItemSelectionModeland implement functions to add and remove selected QModelIndexes so that you add only two-line elements to it. You can do this by performing a special implementation to catch the signals that it QItemSelectionModelemits, for example:
connect(tableWidget->selectionModel(),
SIGNAL(selectionChanged(QItemSelection &, QItemSelection &)),
selectionHandler,
SLOT(updateSelection(QItemSelection &, QItemSelection &)));
selectionHandler - , QModelIndex QItemSelection , , , :
selectionHandler->ignoreSelectionUpdateSignal();
tableWidget->selectionModel()->select(QItemSelection&);
selectionHandler->acceptSelectionUpdateSignal();
ignore accept , selectionChanged .