AtlasAction
One user action with its text, symbol, shortcut and tooltip in one place, shared by toolbar buttons, menu items and the keyboard.
Since 1.4.0
AtlasAction is a Qt Quick Controls Action (text, shortcut, enabled, checkable, checked, triggered()) plus a symbol, a tooltip and a section. A toolbar button, a menu item and the keyboard then run the same code and stay in step. Every action registers with AtlasShortcuts, which warns when two enabled actions share a shortcut and feeds AtlasShortcutsDialog.
AtlasAction is a Qt Quick Templates Action; its inherited properties work as usual. See https://doc.qt.io/qt-6/qml-qtquick-controls-action.html.
Example
AtlasAction {
id: saveAction
text: qsTr("&Save")
symbol: Symbols.Save
shortcut: StandardKey.Save
section: qsTr("File")
onTriggered: document.save()
}Note
Declare it inside an Item so the window it works in is known: shortcuts in the same window conflict, others do not.
Properties
| Name | Type | Default | Description |
|---|---|---|---|
section |
string |
"" |
The group the action shows under in AtlasShortcutsDialog. Empty means the general group. |
symbol |
int (a Symbols.<Name> value, see Symbols) |
0 |
The icon; 0 for none. ToolbarButton, ContextMenuItem and MenuButton show it when given this action. |
toolTip |
string |
text without its & mnemonic marker |
The tooltip of a button that shows this action. |