Signal to select entire row in QTableWidget

Is there a signal when an entire row was selected in a QTableWidget by clicking the buttons on the left? I would like to enable some features, but not sure how?

Thank you in advance!

+3
source share
2 answers

You have several different options. The most direct for what you requested is to use a QHeaderView associated with 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 parameter requires that you check the selection to see if only the whole row is selected, unless SelectionMode allows it from another.

+3

, :

connect(tableWidget->selectionModel(), SIGNAL(currentChanged(const QModelIndex &, const QModelIndex &)), ...)

.

0

Source: https://habr.com/ru/post/1752340/


All Articles