当用户双击qtablewidget标题时,c++ QT4检测
C++ QT4 detecting when a user double clickes a qtablewidget header
我试图检测用户何时双击qtablewidget中的标题。为此,我将信号"sectiondoubleclick (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)"是一个信号,而不是一个插槽?
相关文章:
- 如何在Ubuntu中使用cmake设置qt4
- 将 CMakeLists QT4 更新为 QT5
- 禁用 Qt5 代码中的旧(Qt4 样式)信号槽语法
- QT4:在所有qgraphicsItem上的单个qgraphictem rapers paint()上的update()
- Qt4文件打开错误:没有这样的文件或目录
- 隐藏的过载虚拟功能OSX QT4
- Qt4 QSettings 读取具有多个值的数组
- QT4 > QT5 for uri.queryItems();
- 'QwtPlotLayout' 中没有命名'setMargin'的成员 - 将 Qt4.7 转换为 Qt5.8
- QT4.8嵌入.使用QCursor :: SetPos()调整鼠标输入会导致一个抽搐的光标
- C QT4:添加使用QObject实现的插槽
- 从Qt4移植到Qt5时丢失Ctrl+U组合键
- 如何为macelcapitan安装qt4
- 在Qt4.8中使用不带命名空间的memcpy
- C++ Qt4.8 :: 将对象传递给另一个类 - 成员访问不完整类型错误
- 通过IPC连接Qt4和Qt5进程的最佳方法是什么?
- 在运行QT4程序时抑制控制台窗口
- 如何从Qt4 MVC切换到Gtk MVC
- 开源Qt4的安装程序在哪里
- #include QtWebKit (Qt4) 或 QtWebKitWidgets (Qt<5.6) 或 QtWebEngineWidgets (Qt>=5.6)