MenuBarStyle QML Type
Provides custom styling for MenuBar 更多...
Import Statement: | import QtQuick.Controls.Styles 1.4 |
开始支持版本: | Qt 5.3 |
属性
- background : Component
- font : font
- itemDelegate : Component
- menuStyle : Component
方法
- string formatMnemonic(string text, bool underline)
详细描述
Note: Styling menu bars may not be supported on platforms using native menu bars through their QPA plugin.
属性
background : Component |
The background for the full menu bar.
The background will be extended to the full containing window width. Its height will always fit all of the menu bar items. The final size will include the paddings.
font : font |
The font of the control.
This QML property was introduced in QtQuick.Controls.Styles 1.3.
itemDelegate : Component |
The menu bar item.
This item has to be configured using the styleData object which is in scope, and contains the following read-only properties:
styleData.index : int | The index of the menu item in its menu. |
styleData.selected : bool | true if the menu item is selected. |
styleData.open : bool | true when the pull down menu is open. |
styleData.text : string | The menu bar item's text. |
styleData.underlineMnemonic : bool | When true , the style should underline the menu item's label mnemonic. |
menuStyle : Component |
The style component for the menubar's own menus and their submenus.
参见 MenuStyle.
成员
Returns a formatted string to render mnemonics for a given menu item.
The mnemonic character is prefixed by an ampersand in the original string.
Passing true
for underline
will underline the mnemonic character (e.g., formatMnemonic("&File", true)
will return "<u>F</u>ile"
). Passing false
for underline
will return the plain text form (e.g., formatMnemonic("&File", false)
will return "File"
).
参见 Label.