0

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?

Ashot
  • 10,807
  • 14
  • 66
  • 117

1 Answers1

6

Simply use setSelectionBehavior

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

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

acraig5075
  • 10,588
  • 3
  • 31
  • 50
UldisK
  • 1,619
  • 1
  • 17
  • 25
  • small spelling mistake on your answer, setSelectionBehaviour should change to setSelectionBehavior – DanC225 Mar 22 '17 at 12:04