Receiving signal when pressing on QTableWidget header?



  • Is there a direct way to receive a signal when the user clicks on the header row to QTableWidget?

    For the different table items this is very easy to handle, but I miss the possibility when the click/press is on the header line. Any suggestions?


  • Qt Champions 2017

    @koahnig said in Receiving signal when pressing on QTableWidget header?:

    QTableWidget

    Hi
    What about
    http://doc.qt.io/qt-5/qheaderview.html#sectionPressed
    and
    QTableWidget::horizontalHeader() or QTableWidget::verticalHeader().
    To hook up signal ?
    Might also need void QHeaderView::setSectionsClickable(bool clickable)



  • @mrjj

    Thanks for your response.

    I have to admit that I figured that part already, but it looked a bit out of style for Qt. Therefore, I was not sure, if I simply overlooked a more obvious way. Sometimes one dos not recognize the forest, because of the wood the around ;)

    Finally the implementation looked less complicated than I thought initially. And it works.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.