[Qt] 在QTableWidget中添加右键菜单 [2013-06-17更新]
2013-06-17 08:20
465 查看
- *.h
- *.cpp
#include <QMenu> QMenu *popMenu; QAction *actSelect; QAction *actUnselect;
- *.cpp
popMenu = new QMenu(ui->tw_DL_ConfTable); actSelect = new QAction("选择", this); actUnselect = new QAction("取消选择", this); popMenu->addAction(actSelect); popMenu->addAction(actUnselect); connect(ui->tw_DL_ConfTable, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(slot_DL_RcOnTw(QPoint))); connect(actSelect, SIGNAL(triggered()), this, SLOT(slot_DL_ActSelect())); connect(actUnselect, SIGNAL(triggered()), this, SLOT(slot_DL_ActUnselect())); void MainWindow::slot_DL_RcOnTw(QPoint pos) { popMenu->exec(QCursor::pos()); } void MainWindow::slot_DL_ActSelect() { ... } void MainWindow::slot_DL_ActUnselect() { ... }
相关文章推荐
- qt 添加右键菜单
- 在QT中添加右键菜单
- 【Qt开发】Qt gui添加右键菜单事件
- Qt添加右键菜单的方法
- (整理)Sublime Text 3 安装、破解、安装Package Control、汉化、添加到右键菜单、代码格式化、禁止更新
- Qt 中Treewidget添加右键菜单
- 【Qt开发】Qt gui添加右键菜单事件
- [Qt] 在QTableWidget中添加QCheckBox并使其居中显示 [2012-11-21更新]
- Qt添加右键菜单
- 【Qt】在QTableWidget中添加QCheckBox并使其居中显示【2012-11-21更新】
- 百度地图给多个marker添加右键菜单(删除、更新)
- Qt添加右键菜单
- 在QT中添加右键菜单 .
- Qt 学习(6)在QT中添加右键菜单
- 在QT中添加右键菜单
- 『实践』百度地图给多个marker添加右键菜单(删除、更新)
- Qt界面添加右键菜单
- 百度地图给多个marker添加右键菜单(删除、更新)
- 在QT中添加右键菜单
- Qt添加右键菜单