[英]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)));
我只需要将horizontalHeader()的结果强制转换为QObject *?
您要么没有包含QHeaderView,
#include <QHeaderView>
或未在MainWindow类中将“ headerclickedscan(int)”声明为信号。
您还确定要“ headerclickedscan(int)”作为信号而不是插槽吗?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.