A MenuAction represents a single action that can occupy multiple Menus or a ToolBars, and will evaluate a function when activated. When added to a menu, these are displayed as menu items. When added to a toolbar, they appear as buttons.
Create a new Action. Note that one action may occupy multiple menus and toolbars.
string |
The name of the action. This will be its display name if added to a menu. |
function |
A function to perform when the action is activated. |
An action that represents a menu or toolbar separator. These are not selectable or clickable.
string |
A label for the separator. These are not always visible, depending on your OS and context. |
A string representing the name of the action. This is used as text when it is placed in menus, and on toolbars if it does not have an icon.
A String |
A Menu. If present, this action acts as a submenu, or a pop-up menu when placed on a toolbar.
A Menu |
A string representing the keyboard shortcut to trigger this action. Keyboard shortcuts are available when an action is attached to a ToolBar, or when it's part of the context menu for a View (see View: -setContextMenuActions) Shortcut strings are of the form e.g. "Ctrl+M", "Shift+Alt+space" etc. See https://doc.qt.io/qt-5/qkeysequence.html#details for more info.
A String |
Indicates whether the action is checked or unchecked.
A boolean. |
A string to display when hovering over the menu item / button.
A String |
Indicates whether the action is a separator.
A Boolean. |
Indicates whether the icon for this action will be visible.
A Boolean. |
Indicates that the action shows a checkbox and is checkable.
A Boolean |
Indicates that the action is enabled; otherwise it will be greyed out and uninteractive.
A Boolean |
An Image associated with the action - to be shown next to the name of the action in both menus and toolbars.
An Image |
The font used to display the action's name. Note that special fonts may or may not be displayed depending on OS and context (e.g. system menu, context menu, toolbar). For example, OSX application menus will honor italicized fonts, but not the font family itself.
A Font |
Menu actions broadcast several kinds of events that can be registered for with the standard Object: -addDependant calls. Events broadcast by menu:
\changed
(issued when one of the actions properties changes)\triggered
(issued when the action is clicked / activated - value is a boolean representing whether the action is checked)\hovered
\toggled
Events example
Simple checkable menu item
Action help strings
A more complex example