poll QTableView for selected headers
Solved
General and Desktop
-
I have a QTableView in which the headers are selectable. I would like to poll its headers to know which headers are selected. I can't find any information on this.
Is this possible?
-
Get the
QItemSelectionModel
pointer for the relevantQHeaderView
and from that use theselected()
member to check the selection status of the items. -
Better still, connect the
selectionChanged()
signal for the header view items then there is no need to poll at all.http://doc.qt.io/qt-5/qitemselectionmodel.html#selectionChanged
-
@bsomervi
Better is in the eyes of the beholder. Why keep track of something that the system keeps track of for you? I don't need this information immediately, just when a context menu item is selected.Thanks for the answer.
4/4