20 #ifndef _STELACTIONMGR_HPP_ 21 #define _STELACTIONMGR_HPP_ 23 #include "StelPropertyMgr.hpp" 24 #include <QKeySequence> 61 bool isGlobal()
const {
return global;}
66 QKeySequence::SequenceMatch matches(
const QKeySequence& seq)
const;
69 QString
getId()
const {
return objectName();}
70 QString getGroup()
const {
return group;}
71 const QKeySequence getShortcut()
const {
return keySequence;}
72 const QKeySequence getAltShortcut()
const {
return altKeySequence;}
73 QString getText()
const;
74 void setText(
const QString& value) {text = value; emit
changed();}
98 void propertyChanged(
bool);
104 const QString& groupId,
106 const QString& primaryKey=
"",
107 const QString& altKey=
"",
113 void connectToObject(QObject* target,
const char* slot);
118 QKeySequence keySequence;
119 QKeySequence altKeySequence;
120 const QKeySequence defaultKeySequence;
121 const QKeySequence defaultAltKeySequence;
131 #ifndef USE_QUICKVIEW 135 class QAction* qAction;
160 StelAction* addAction(
const QString&
id,
const QString& groupId,
const QString& text,
161 QObject* target,
const char* slot,
162 const QString& shortcut=
"",
const QString& altShortcut=
"",
165 bool pushKey(
int key,
bool global=
false);
168 QStringList getGroupList()
const;
170 QList<StelAction*> getActionList(
const QString& group)
const;
172 QList<StelAction*> getActionList()
const;
175 void saveShortcuts();
177 void restoreDefaultShortcuts();
183 void actionToggled(
const QString&
id,
bool value);
185 void shortcutsChanged();
194 void onStelActionToggled(
bool val);
198 QList<int> keySequence;
201 #endif // _STELACTIONMGR_HPP_
Wrapper around a Q_PROPERTY (see the Qt property system for more information) of a specific object...
bool checked
When the StelAction is checkable, this may be used to get/set the current value.
void setShortcut(const QString &key)
Defines the key-combination used to call this action.
bool checkable
If this is true, this StelAction can be toggled.
void triggered()
Emitted after an argumentless slot has been called.
QVariant getValue() const
Returns the current value of this property as a QVariant.
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.
QString getId() const
The ID of this action. Must be unique.
void setAltShortcut(const QString &key)
Defines an alternative key-combination.
void toggled(bool)
Emitted when the boolean state of this StelAction changes.
void changed()
Emitted when additional data associated with this action changed (i.e. shortcuts, text...
void toggle()
If the action is checkable, this toggles the value of the connected boolean property.
Manager for StelAction instances. Allows registration of new actions, and finding an existing one by ...
void trigger()
If the action is checkable, toggle() is called.
void setAllActionsEnabled(bool value)
Enable/disable all actions of application.