开发者

C++ QT4 detecting when a user double clickes a qtablewidget header

I am trying to detect when a user double clicks a header in a qtablewidget. To do this I am connecting to the signal "sectionDoubleClicked(int)" to a function with the same arguments (i got this from 1 ). My issue is that I am getting the following compile time error:

mainwindow.cpp:117: error: no matching function for call to âMainWindow::connect(QHeaderView*, const char [27], MainWindow* const, const char [24])â
/usr/lib64/qt4/include/QtCore/qobject.h:181: note: candidates are: static bool QObject::connect(const QObject*, const char*, const QObject*, const char*, Qt::ConnectionType)
/usr/lib64/qt4/include/QtCore/qobject.h:282: note:                 bool QObject::connect(const QObject*, const char*, 开发者_Go百科const char*, Qt::ConnectionType) const

Here is my code:

QObject::connect(ui->table_results->horizontalHeader(),SIGNAL(sectionDoubleClicked(int)),
              this,SIGNAL(headerclickedscan(int)));

do I just need to cast the result of horizontalHeader() to a QObject*?


You either didn't include QHeaderView by

#include <QHeaderView>

or didn't declare "headerclickedscan(int)" as signal in your MainWindow class.

Also are you sure you want "headerclickedscan(int)" to be a signal but not a slot ?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜