Stellarium 0.90.0
List of all members | Public Slots | Signals | Public Member Functions | Properties | Friends
StelAction Class Reference

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>

+ Inheritance diagram for StelAction:
+ Collaboration diagram for StelAction:

Public Slots

void setChecked (bool)
 
void trigger ()
 If the action is checkable, toggle() is called. More...
 
void toggle ()
 If the action is checkable, this toggles the value of the connected boolean property. More...
 

Signals

void toggled (bool)
 Emitted when the boolean state of this StelAction changes. More...
 
void triggered ()
 Emitted after an argumentless slot has been called. More...
 
void changed ()
 Emitted when additional data associated with this action changed (i.e. shortcuts, text,...) More...
 

Public Member Functions

bool isCheckable () const
 
bool isChecked () const
 
bool isGlobal () const
 
void setShortcut (const QString &key)
 Defines the key-combination used to call this action. More...
 
void setAltShortcut (const QString &key)
 Defines an alternative key-combination. More...
 
QKeySequence::SequenceMatch matches (const QKeySequence &seq) const
 
QString getId () const
 The ID of this action. Must be unique. More...
 
QString getGroup () const
 
const QKeySequence getShortcut () const
 
const QKeySequence getAltShortcut () const
 
QString getText () const
 
void setText (const QString &value)
 

Properties

bool checked
 When the StelAction is checkable, this may be used to get/set the current value. More...
 
bool checkable
 If this is true, this StelAction can be toggled. More...
 

Friends

class StelActionMgr
 

Detailed Description

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.

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

Definition at line 42 of file StelActionMgr.hpp.

Member Function Documentation

void StelAction::changed ( )
signal

Emitted when additional data associated with this action changed (i.e. shortcuts, text,...)

QString StelAction::getId ( ) const
inline

The ID of this action. Must be unique.

Definition at line 69 of file StelActionMgr.hpp.

bool StelAction::isCheckable ( ) const
inline
See also
checkable

Definition at line 58 of file StelActionMgr.hpp.

bool StelAction::isChecked ( ) const
inline
See also
checked

Definition at line 60 of file StelActionMgr.hpp.

void StelAction::setAltShortcut ( const QString &  key)

Defines an alternative key-combination.

void StelAction::setChecked ( bool  )
slot
See also
checked
Warning
If used on a non-checkable action, the program may crash.
void StelAction::setShortcut ( const QString &  key)

Defines the key-combination used to call this action.

void StelAction::toggle ( )
slot

If the action is checkable, this toggles the value of the connected boolean property.

Warning
If used on a non-checkable action, the program may crash.
void StelAction::toggled ( bool  )
signal

Emitted when the boolean state of this StelAction changes.

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

If the action is checkable, toggle() is called.

Otherwise, the connected slot is invoked.

void StelAction::triggered ( )
signal

Emitted after an argumentless slot has been called.

Property Documentation

bool StelAction::checkable
read

If this is true, this StelAction can be toggled.

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.

Definition at line 55 of file StelActionMgr.hpp.

bool StelAction::checked
readwrite

When the StelAction is checkable, this may be used to get/set the current value.

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.

Definition at line 49 of file StelActionMgr.hpp.


The documentation for this class was generated from the following file: