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() 信号。