MenuBarItem QML Type
| Import Statement: | import QtQuick.Controls |
| Inherits: |
属性
- highlighted : bool
- menu : Menu
- menuBar : Menu
信号
- void triggered()
详细说明
MenuBarItem 在MenuBar 中呈现一个菜单。当通过键盘、鼠标或触摸操作triggered MenuBarItem时,相应的下拉菜单便会显示出来。

MenuBarItem 被用作MenuBar 的默认delegate 类型。请注意,在使用MenuBar 时,无需手动声明 MenuBarItem 实例。只需将 Menu 实例声明为MenuBar 的子元素,相应的菜单项就会自动创建。
另请参阅 《自定义菜单栏》(Customizing MenuBar)、《菜单控件》(MenuBar )以及《菜单控件》。
属性文档
highlighted : bool
该属性表示菜单栏项目是否被用户高亮显示。
菜单栏项目可通过鼠标悬停或键盘导航被高亮显示。
默认值为false 。
menu : Menu
该属性存储此项目在菜单栏中显示的菜单,如果该项目没有菜单,则存储null 。
menuBar : Menu [read-only]
该属性表示包含此项目的菜单栏,如果该项目不在菜单栏中,则返回null 。
Signal 文档
void triggered()
当用户触发菜单栏项目时,会发出此信号。
注意: 相应的处理程序 是onTriggered 。
© 2026 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.