Qt / C ++ QTableWidget: Doing something when the header is double clicked

I have a QTableWidget in my form, and I want to do something when the user is looping twice on the row or column header. I use the following connect statement:

connect(ui->tblResults->horizontalHeader(),SIGNAL(doubleClicked(QModelIndex)),this,SLOT(tableDoubleClicked(QModelIndex)));

Where thisis the window class, and ui-> tblResults is the QTableWidget in the form of a window. When I try to double-click the title, nothing happens. The slot I'm connecting to is:

void wndSearch::tableDoubleClicked(QModelIndex tmp){
    QMessageBox::information(0,"DERP!","TEST");
}

Very simple, just testing to see if a slot has been called. I never get this message. I do not get any error while calling connect ().

Am I using the wrong signal? Is something else wrong? Please let me know if you need more information and thanks for the help!

[] - #qt freenode . , , DoubleClicked (int)

+3
1

http://doc.qt.nokia.com/latest/qheaderview.html#sectionDoubleClicked

QHeaderView QTableWidget::horizontalHeader() QTableWidget::verticalHeader().

+4

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


All Articles