MenuBar QML Type
本地菜单更多
Import Statement: | import Qt.labs.platform |
Inherits: |
属性
方法
- void addMenu(Menu menu)
- void clear()
- void insertMenu(int index, Menu menu)
- void removeMenu(Menu menu)
详细说明
MenuBar 类型为本地平台菜单栏提供了 QML API。
菜单栏由一系列下拉菜单组成。
MenuBar { id: menuBar Menu { id: fileMenu title: qsTr("File") // ... } Menu { id: editMenu title: qsTr("&Edit") // ... } Menu { id: viewMenu title: qsTr("&View") // ... } Menu { id: helpMenu title: qsTr("&Help") // ... } }
MenuBar 目前适用于以下平台:
- MacOS
- 安卓
- Linux(仅适用于提供全局 D-Bus 菜单栏的桌面环境)
- Windows
注: Qt.lab 模块中的类型不保证在未来版本中保持兼容。
另请参阅 Menu 。
属性文档
方法文档
void addMenu(Menu menu) |
在菜单栏末尾添加menu 。
void clear() |
删除菜单栏中的所有菜单。
void removeMenu(Menu menu) |
从菜单栏中删除menu 。
© 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.