Reputation: 11662
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!
Upvotes: 4
Views: 9156
Reputation: 165
This is what worked for me:
connect(tableWidget->selectionModel(), SIGNAL(currentChanged(const QModelIndex &, const QModelIndex &)), ...)
I got the idea from here.
Upvotes: 0
Reputation: 46469
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.
Upvotes: 4