Ashot
Ashot

Reputation: 10979

QTableWidget change selection mode

When clicking on QTableWidget cell, it selects only the cell. How to configure tablewidget, so that when click on a cell , the whole row will be selected which contains the cell?

It can be done using signal,slots. I'm curious is there standard way doing it?

Upvotes: 0

Views: 10456

Answers (1)

UldisK
UldisK

Reputation: 1639

Simply use setSelectionBehavior

QTableView * tmp = new QTableView();
tmp->setSelectionBehavior(QAbstractItemView::SelectRows);

http://doc.qt.io/qt-5/qabstractitemview.html#SelectionBehavior-enum

Upvotes: 6

Related Questions