我使用QTableView,我想开发高级选择模式。我没有设法做到这一点SelectionBehavior
也没有SelectionMode
。QTableView高级选择
用户应能够拿起一些细胞,但只有当他们属于同一列:
- VALID行为:
- INVALID BEHAVIOR:
上锦上添花的是防止最后一行(黄色的)被选中。
有没有解决方法?
编辑 - 2013年3月5日
我无法得到它的工作:
ui->table->setSelectionBehavior(QAbstractItemView::SelectItems);
ui->table->setSelectionMode(QAbstractItemView::MultiSelection);
connect(ui->table->selectionModel(), SIGNAL(currentColumnChanged(QModelIndex,QModelIndex)), ui->table->selectionModel(), SLOT(clearSelection()));
有什么不对的代码?我也试过QAbstractItemView::ExtendedSelection
和QAbstractItemView::ContiguousSelection
。
相关问题:[如何限制QTableWidget中的选择](http://stackoverflow.com/q/8658656/20984)。 – 2013-02-28 08:25:56
太棒了!谢谢!! – Maxbester 2013-02-28 09:23:47