Qt 菜单策略

Qt 菜单策略

  • Qt::NoContextMenu the widget does not feature a context menu, context menu handling is deferred to the widget's parent.

  • Qt::PreventContextMenu the widget does not feature a context menu, and in contrast to NoContextMenu, the handling is not deferred to the widget's parent. This means that all right mouse button events are guaranteed to be delivered to the widget itself through mousePressEvent(), and mouseReleaseEvent().

  • Qt::DefaultContextMenu the widget's QWidget::contextMenuEvent() handler is called.
  • Qt::ActionsContextMenu the widget displays its QWidget::actions() as context menu.

  • Qt::CustomContextMenu the widget emits the QWidget::customContextMenuRequested() signal.

Qt::NoContextMenu

默认值,widget 不具有菜单属性, 菜单处理跟随父对象。

Qt::PreventContextMenu

widget 不具有菜单属性,但与 NoContextMenu 不同的是,菜单操作的信号并不是跟随父窗体。
它保证所有的鼠标右击事件都能发送到它自身,通过mousePressEvent() 和 mouseReleaseEvent ()

Qt::DefaultContextMenu

Widget 会调用 QWidget::contextMenuEvent()

Qt::ActionsContextMenu

Widget 会显示所有QWidget::actions() 作为右键菜单

Qt::CustomContextMenu

widget 会发送 QWidget::customContextMenyRequested() 信号。

转载于:https://www.cnblogs.com/lnstree/p/4664378.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值