菜单控件
附加类型提供了一种以适合平台的方式打开上下文菜单的方法 | |
弹出式菜单,可用作上下文菜单或弹出菜单 | |
提供窗口菜单栏 | |
在菜单栏中显示下拉菜单 | |
在菜单中显示一个项目 |
每种类型的菜单控件都有自己特定的目标用例。以下各节提供了根据用例选择适当类型菜单控件的指南。
菜单控件
Menu 菜单控件可用于右键单击后的上下文菜单。它也可用于弹出式菜单;例如,点击按钮后显示的菜单。
MenuItem 是菜单控件中的一个项目。菜单中的每个项目
- 向用户显示文本
- 允许选中/取消选中
- 高亮显示(例如在键盘导航时)
- 激活时执行某些操作
菜单栏控件
MenuBar 该控件可用于窗口菜单栏。
MenuBarItem 是 控件中的一个项目。菜单栏中的每个项目:MenuBar
- 向用户显示文本
- 高亮显示(例如,在键盘导航时)
- 激活时弹出相应菜单
© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.