• 5600阅读
  • 1回复

求教:如何点鼠标右键弹出菜单 [复制链接]

上一主题 下一主题
离线xnmd2000
 
只看楼主 倒序阅读 楼主  发表于: 2008-11-27
— 本帖被 XChinux 从 Qt Installing & Deployment 移动到本区(2008-11-30) —
QT4中 如何点鼠标右键弹出一个菜单

请各位大侠赐教
[ 此贴被XChinux在2008-11-30 09:50重新编辑 ]
离线lazybone
只看该作者 1楼 发表于: 2008-11-29
控件.setContextMenuPolicy(Qt.ContextMenuPolicy.XXX);

Qt.ContextMenuPolicy可选的有5种,就用过两种

1-ActionsContextMenu  把窗口的Action直接添加进去
          the widget displays its QWidget::actions() as context menu.
2-CustomContextMenu
          the widget emits the QWidget::customContextMenuRequested() signal.
3-DefaultContextMenu  默认的。比如文本框出来复制粘贴之类的
          the widget's QWidget::contextMenuEvent() handler is called.
4-NoContextMenu
          the widget does not feature a context menu, context menu handling is deferred to the widget's parent.
5-PreventContextMenu
          the widget does not feature a context menu, and in contrast to NoContextMenu, the handling is not deferred to the widget's parent.
快速回复
限100 字节
 
上一个 下一个