Stellarium  23.4
Public Slots | Signals | Public Member Functions
StelActionMgr Class Reference

Manager for StelAction instances. Allows registration of new actions, and finding an existing one by name. More...

#include <StelActionMgr.hpp>

Public Slots

void setAllActionsEnabled (bool value)
 Enable/disable all actions of application. More...
 

Signals

void actionToggled (const QString &id, bool value)
 Emitted when any action registered with this StelActionMgr is toggled. More...
 
void shortcutsChanged ()
 

Public Member Functions

StelActionaddAction (const QString &id, const QString &groupId, const QString &text, QObject *target, const char *slot, const QString &shortcut="", const QString &altShortcut="", bool global=false)
 Create and add a new StelAction, connected to an object property or slot. More...
 
StelActionaddAction (const QString &id, const QString &groupId, const QString &text, QObject *context, std::function< void()> lambda, const QString &shortcut="", const QString &altShortcut="", bool global=false)
 Create and add a new StelAction, connected to an object slot. More...
 
StelActionfindAction (const QString &id)
 
StelActionfindActionFromShortcut (const QString &shortcut)
 
bool pushKey (int key, bool global=false)
 
QStringList getGroupList () const
 Returns a list of all current StelAction groups.
 
QList< StelAction * > getActionList (const QString &group) const
 Returns all StelActions in the specified group.
 
QList< StelAction * > getActionList () const
 Returns all registered StelActions.
 
QStringList getShortcutsList () const
 
void saveShortcuts ()
 Save current shortcuts to file.
 
void restoreDefaultShortcuts ()
 Restore the default shortcuts combinations.
 
void restoreDefaultShortcut (StelAction *action)
 

Detailed Description

Manager for StelAction instances. Allows registration of new actions, and finding an existing one by name.

Member Function Documentation

◆ actionToggled

void StelActionMgr::actionToggled ( const QString &  id,
bool  value 
)
signal

Emitted when any action registered with this StelActionMgr is toggled.

Parameters
idThe id of the action that was toggled
valueThe new value of the action

◆ addAction() [1/2]

StelAction* StelActionMgr::addAction ( const QString &  id,
const QString &  groupId,
const QString &  text,
QObject *  context,
std::function< void()>  lambda,
const QString &  shortcut = "",
const QString &  altShortcut = "",
bool  global = false 
)

Create and add a new StelAction, connected to an object slot.

Parameters
idGlobal identifier.
groupIdGroup identifier.
textShort human-readable description in English.
contexta reference object. When this is deleted, the Lambda function will not be called.
lambdaa void function (Lambda). This can call slots and other functions.
shortcutDefault shortcut/key combination for this action
altShortcutAlternative shortcut
globaldetermines QAction shortcut context (not necessary anymore?)

◆ addAction() [2/2]

StelAction* StelActionMgr::addAction ( const QString &  id,
const QString &  groupId,
const QString &  text,
QObject *  target,
const char *  slot,
const QString &  shortcut = "",
const QString &  altShortcut = "",
bool  global = false 
)

Create and add a new StelAction, connected to an object property or slot.

Parameters
idGlobal identifier.
groupIdGroup identifier.
textShort human-readable description in English.
targetThe QObject the action is linked to.
slotThe target slot or property that the action will trigger. Either a slot name of the form 'func()' and in that case the action is made non checkable, a slot name of the form 'func(bool)' and in that case the action is made checkable, or a property name and in that case the action is made checkable.
shortcutDefault shortcut/key combination for this action
altShortcutAlternative shortcut
globaldetermines QAction shortcut context (not necessary anymore?)

◆ setAllActionsEnabled

void StelActionMgr::setAllActionsEnabled ( bool  value)
inlineslot

Enable/disable all actions of application.

need for editing shortcuts without trigging any actions