class Crysterm::Action
- Crysterm::Action
- Reference
- Object
Overview
Many common commands can be invoked via different interfaces (menus, toolbar buttons, keyboard shortcuts, etc.).
Because they are expected to run in the same way, regardless of the user interface used, it is useful to represent them with Action
s.
Actions can be added to menus and toolbars, and will automatically be kept in sync because they are the same object. For example, if the user presses a "Bold" toolbar button in a text editor, the "Bold" menu item will automatically appear enabled where ever it is added.
It is recommended to create Action
s as children of the window they are used in.
Actions are added to Widget
s using #addAction
or <<(Action)
. Note that an action must be added to a widget before it can be used.
NOTE Actions are inspired by QAction
(https://doc.qt.io/qt-6/qaction.html)
Included Modules
- EventHandler
Defined in:
action.crConstructors
Instance Method Summary
-
#activate(event : OneOfEvents = Crysterm::Event::Triggered)
Activates the action
-
#enabled : Bool
Action enabled?
-
#enabled=(enabled : Bool)
Action enabled?
- #shortcut : KeySequence | Nil
- #shortcut=(shortcut : KeySequence | Nil)
-
#status_tip : String | Nil
Tip to show in status bar, if/when applicable
-
#status_tip=(status_tip : String | Nil)
Tip to show in status bar, if/when applicable
-
#text : String
Text / label of action
-
#text=(text : String)
Text / label of action
-
#tool_tip=(tool_tip : String | Nil)
Tip to show in a popup on hover over the action, if/when applicable
-
#visible=(visible : Bool)
This property holds whether the action can be seen (e.g.
-
#visible? : Bool
This property holds whether the action can be seen (e.g.
-
#whats_this : String | Nil
Tip to show in a popup when broader help text / description is requested
-
#whats_this=(whats_this : String | Nil)
Tip to show in a popup when broader help text / description is requested
Constructor Detail
Instance Method Detail
Tip to show in status bar, if/when applicable
Tip to show in a popup on hover over the action, if/when applicable
This property holds whether the action can be seen (e.g. in menus and toolbars) or is hidden.
This property holds whether the action can be seen (e.g. in menus and toolbars) or is hidden.
Tip to show in a popup when broader help text / description is requested
Tip to show in a popup when broader help text / description is requested