Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Signal for Entire Row Selection in QTableWidget

Tags:

qt

Is there a signal for when an entire row in the QTableWidget has been selected by pressing the buttons that are stacked on the left? I would like that to enable some functionality, but am not sure how?

Thank you in advance!

like image 838
Cenoc Avatar asked Sep 18 '25 09:09

Cenoc


1 Answers

You have a couple of different options. The most direct for what you've asked is to use the QHeaderView that's associated with the buttons:

// you could also use verticalHeader()
connect(tableWidget->horizontalHeader(), SIGNAL(sectionClicked(int)), ...);

Another option is to listen to the selection model:

connect(tableWidget->selectionModel(), SIGNAL(selectionChanged(const QItemSelection&, const QItemSelection&)), ...)

But, this option would require that you check the selection to see if only an entire row is selected, unless your SelectionMode prevents it from being otherwise.

like image 114
Kaleb Pederson Avatar answered Sep 22 '25 05:09

Kaleb Pederson



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!