MenuBarStyle QML Type

Provides custom styling for MenuBar. More...

Import Statement: import QtQuick.Controls.Styles 1.4
Since: Qt 5.3

Properties

Methods

Detailed Description

Note: Styling menu bars may not be supported on platforms using native menu bars through their QPA plugin.

Property Documentation

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 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 : intThe index of the menu item in its menu.
styleData.selected : booltrue if the menu item is selected.
styleData.open : booltrue when the pull down menu is open.
styleData.text : stringThe menu bar item's text.
styleData.underlineMnemonic : boolWhen true, the style should underline the menu item's label mnemonic.

The style component for the menubar's own menus and their submenus.

See also MenuStyle.


Method Documentation

string formatMnemonic(string text, bool underline = false)

Returns a formatted string to render mnemonics for a given menu item text.

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").

See also Label.


© 2020 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.