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 に答える