Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Highlight entire row of a QTableWidget

Tags:

c++

widget

qt

I want to highlight the entire row of a my QTableWidget when I click on one cell of this row.

I already put a connection between an activation of my cell and my function highlightRow :

QObject::connect(ui->variableTableWidget,SIGNAL(cellActivated(int,int)), this, SLOT(highlightRow()));

Now I have to write my function, but I don't know how could I know which cell is activated. Is there a function in the QTableWidget that is suppose to return all activated cell ?

like image 477
Evans Belloeil Avatar asked Jun 04 '14 10:06

Evans Belloeil


1 Answers

Call this on your table widget when it is created

setSelectionBehavior(QAbstractItemView::SelectRows);

this will make it so that when you click on a cell that row is selected

like image 129
AngryDuck Avatar answered Nov 08 '22 00:11

AngryDuck