PDA

View Full Version : What signal for QTableView Row Column Push



KenJustKen
4th February 2016, 19:05
I have a QTableView in my code that I am trying to detect when the user clicks on the RowHeaders. I have the individual cells working with the code below and they work great. But what signal do I connect for the Row/Column headers being pushed.




QTableView *pkt_view;

...

connect( pkt_view, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(packetClicked2(QModelIndex)) );
connect( pkt_view, SIGNAL(clicked(QModelIndex)), this, SLOT(packetClicked(QModelIndex)) );

anda_skoa
4th February 2016, 19:42
Get the view's vertical header view and connect to that object's sectionClicked() signal.

Cheers,
_

KenJustKen
4th February 2016, 20:52
Thanks. I was looking for clicked and not sectionClicked...


connect( pkt_view, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(packetClicked(QModelIndex)) );
connect( pkt_view, SIGNAL(clicked(QModelIndex)), this, SLOT(packetClicked2(QModelIndex)) );
connect( pkt_view->verticalHeader(), SIGNAL(sectionClicked(int)), this, SLOT(HeaderClicked(int)) );