34 #include <QtCore/QList>
35 #include <QtCore/QMultiMap>
36 #include <QtCore/QPointer>
37 #include <QKeySequence>
49 virtual QString
name()
const = 0;
104 QShortcut *m_shortcut;
105 QString m_defaultText;
114 QString
name()
const;
147 void actionChanged();
150 QPointer<QAction> m_currentAction;
152 QMap<int, QPointer<QAction>> m_contextActionMap;
154 bool m_contextInitialized;
160 #endif // COMMAND_P_H
virtual ~CommandPrivate()
void addOverrideAction(QAction *action, const QList< int > &context)
void setKeySequence(const QKeySequence &key)
QKeySequence keySequence() const
bool setCurrentContext(const QList< int > &context)
QKeySequence keySequence() const
void setAction(QAction *action)
virtual QString name() const =0
void setKeySequence(const QKeySequence &key)
void setContext(const QList< int > &context)
void setDefaultKeySequence(const QKeySequence &key)
bool setCurrentContext(const QList< int > &context)
QString stringWithAppendedShortcut(const QString &str) const
QList< CommandLocation > locations() const
void setLocations(const QList< CommandLocation > &locations)
virtual void setAction(QAction *action)
void updateToolTipWithKeySequence()
virtual void setDefaultText(const QString &key)
QList< int > context() const
QShortcut * shortcut() const
void setDefaultKeySequence(const QKeySequence &key)
virtual bool setCurrentContext(const QList< int > &context)=0
void setDefaultText(const QString &text)
OverrideableAction(int id)
virtual QString defaultText() const
QKeySequence defaultKeySequence() const
bool hasAttribute(CommandAttribute attr) const
void setAttribute(CommandAttribute attr)
QString defaultText() const
void setDefaultKeySequence(const QKeySequence &key)
void removeAttribute(CommandAttribute attr)
QList< CommandLocation > m_locations
The class Command represents an action like a menu item, tool button, or shortcut. You don't create Command objects directly, instead use {ActionManager::registerAction()} to register an action and retrieve a Command. The Command object represents the user visible action and its properties. If multiple actions are registered with the same ID (but different contexts) the returned Command is the shared one between these actions.
void setShortcut(QShortcut *shortcut)
QShortcut * shortcut() const
QKeySequence m_defaultKey