Skip to content
Browse the docs

TelamonAction

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

TelamonAction 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 TelamonShortcuts, which warns when two enabled actions share a shortcut and feeds TelamonShortcutsDialog. Declare the app's actions together in a TelamonActionCollection to let the user change shortcuts.

TelamonAction 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

TelamonAction {
    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
menu Menu null A ContextMenu that the action's ToolbarButton opens instead of triggering. In a TelamonAppMenu it shows as a submenu. If both menu and popover are set, menu wins.
popover Popup null A TelamonPopover that the action's toolbar button opens instead of triggering. Its target is set to the button.
category string section The group the action shows under in TelamonShortcutsDialog and the command palette, and the menu it goes in when a TelamonAppMenu builds its menus from a TelamonActionCollection. It follows section unless set.
section string "" The group the action shows under in TelamonShortcutsDialog. 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.