0

我试图检测用户何时双击 qtablewidget 中的标题。为此,我将信号“sectionDoubleClicked(int)”连接到具有相同参数的函数(我从1得到这个)。我的问题是我收到以下编译时错误:

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*, const char*, Qt::ConnectionType) const

这是我的代码:

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

我只需要将 Horizo​​ntalHeader() 的结果转换为 QObject* 吗?

4

1 回答 1

0

您要么没有包含 QHeaderView

#include <QHeaderView>

或者没有在 MainWindow 类中将“headerclickedscan(int)”声明为信号。

另外你确定你想让“headerclickedscan(int)”成为一个信号而不是一个插槽吗?

于 2011-04-13T04:09:44.040 回答