poll QTableView for selected headers
-
wrote on 6 Jan 2016, 13:16 last edited by
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?
-
wrote on 6 Jan 2016, 13:34 last edited by
Get the
QItemSelectionModel
pointer for the relevantQHeaderView
and from that use theselected()
member to check the selection status of the items. -
wrote on 6 Jan 2016, 13:37 last edited by
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
-
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
wrote on 6 Jan 2016, 15:48 last edited by@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.
1/4