# TelamonAction

> One user action with its text, symbol, shortcut and tooltip in one place, shared by toolbar buttons, menu items and the keyboard.

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](https://telamon.eterneon.net/framework/telamon-ui/telamon-shortcuts.md), which warns when two enabled actions share a shortcut and feeds [TelamonShortcutsDialog](https://telamon.eterneon.net/framework/telamon-ui/telamon-shortcuts-dialog.md). Declare the app's actions together in a [TelamonActionCollection](https://telamon.eterneon.net/framework/telamon-ui/telamon-action-collection.md) 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

```qml
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](https://telamon.eterneon.net/framework/telamon-ui/context-menu.md) that the action's [ToolbarButton](https://telamon.eterneon.net/framework/telamon-ui/toolbar-button.md) opens instead of triggering. In a [TelamonAppMenu](https://telamon.eterneon.net/framework/telamon-ui/telamon-app-menu.md) it shows as a submenu. If both `menu` and `popover` are set, `menu` wins. |
| `popover` | `Popup` | `null` | A [TelamonPopover](https://telamon.eterneon.net/framework/telamon-ui/telamon-popover.md) 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](https://telamon.eterneon.net/framework/telamon-ui/telamon-app-menu.md) builds its menus from a [TelamonActionCollection](https://telamon.eterneon.net/framework/telamon-ui/telamon-action-collection.md). 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](https://telamon.eterneon.net/framework/telamon-ui/symbols.md)) | `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. |
