I work with a QTableView and I would like to develop an advanced selection mode. I have not managed to do it with SelectionBehavior
nor with SelectionMode
.
The user shall be able to pick up some cells but only if they belong to the same column:
- VALID BEHAVIOURS:
- INVALID BEHAVIOUR:
The icing on the cake would be to prevent the last row (yellow one) to be selected.
Is there any solution?
EDIT - 2013/03/05
I cannot get it work:
ui->table->setSelectionBehavior(QAbstractItemView::SelectItems);
ui->table->setSelectionMode(QAbstractItemView::MultiSelection);
connect(ui->table->selectionModel(), SIGNAL(currentColumnChanged(QModelIndex,QModelIndex)), ui->table->selectionModel(), SLOT(clearSelection()));
What's wrong with this code? I also tried QAbstractItemView::ExtendedSelection
and QAbstractItemView::ContiguousSelection
.