Wrapper around an argumentless QObject slot or a bool Q_PROPERTY with WRITE method, allowing the slot to be called/property to be toggled using this action object.
More...
#include <StelActionMgr.hpp>
|
void | toggled (bool) |
| Emitted when the boolean state of this StelAction changes. More...
|
|
void | triggered () |
| Emitted after an argumentless slot has been called.
|
|
void | changed () |
| Emitted when additional data associated with this action changed (i.e. shortcuts, text,...)
|
|
|
bool | isCheckable () const |
|
bool | isChecked () const |
|
bool | isGlobal () const |
|
void | setShortcut (const QString &key) |
| Defines the key-combination used to call this action.
|
|
void | setAltShortcut (const QString &key) |
| Defines an alternative key-combination.
|
|
QKeySequence::SequenceMatch | matches (const QKeySequence &seq) const |
|
QString | getId () const |
| The ID of this action. Must be unique.
|
|
QString | getGroup () const |
|
const QKeySequence | getShortcut () const |
|
const QKeySequence | getAltShortcut () const |
|
QString | getText () const |
|
void | setText (const QString &value) |
|
The action object can be identified by a unique string, and found through StelActionMgr::findAction. Use StelActionMgr::addAction to define a new action. In StelModule subclasses, one can also use StelModule::addAction for convenience.
StelAction objects are intended for user interaction. They automatically show up in the hotkey configuration dialog (ShortcutsDialog), and can be bound to interface buttons (StelButton).
StelAction internally uses a StelProperty, if connected to a property. A new StelProperty with the name of the action is registered automatically in this case. A NOTIFY signal should be provided, though not strictly necessary, it is really recommended.
- Note
- If you want to have a globally accessible reference to arbitrary Q_PROPERTY instances (not just bool), or don't want to expose the property to the user you could use a StelProperty directly registered through the StelPropertyMgr instead.
- See also
- StelActionMgr, StelProperty
bool StelAction::isCheckable |
( |
| ) |
const |
|
inline |
bool StelAction::isChecked |
( |
| ) |
const |
|
inline |
void StelAction::setChecked |
( |
bool |
| ) |
|
|
slot |
- See also
- checked
- Warning
- If used on a non-checkable action, the program may crash.
void StelAction::toggle |
( |
| ) |
|
|
slot |
- Warning
- If used on a non-checkable action, the program may crash.
void StelAction::toggled |
( |
bool |
| ) |
|
|
signal |
When the action is connected to a StelProperty, this is equivalent to the StelProperty::valueChanged signal. In the other cases, this state may not always be emitted correctly (i.e. when the state changes through other mechanisms than StelAction)
void StelAction::trigger |
( |
| ) |
|
|
slot |
Otherwise, the connected slot is invoked.
bool StelAction::checkable |
|
read |
This is the case when connected to a boolean Q_PROPERTY. This means the checked property as well as the toggle() function may be used If false, the StelAction represents a simple argumentless slot call. Using checked or toggle() may result in an error.
Note that the toggled signal may not be emitted on all changes of the connected property
- Warning
- If used on a non-checkable action, the program may crash.