簡體   English   中英

C ++ QT4檢測用戶何時雙擊qtablewidget標頭

[英]C++ QT4 detecting when a user double clickes a qtablewidget header

我正在嘗試檢測用戶何時雙擊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 *?

您要么沒有包含QHeaderView,

#include <QHeaderView>

或未在MainWindow類中將“ headerclickedscan(int)”聲明為信號。

您還確定要“ headerclickedscan(int)”作為信號而不是插槽嗎?

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM