Search code examples
c++qtselectionqtableviewqtablewidget

How to completely disable selection for qtableview (for all cells)?


I want my table to be not selectable, so that only check boxes or radio buttons could be selected, but not the cell itself. Now I have:

enter image description here

How can I fix this?

Solutions for QTableWidget can help too.


Solution

  • QTableView *test = new QTableView();
    test->setSelectionMode(QAbstractItemView::NoSelection);
    

    gives the wanted result.