33 #include <QtCore/QObject>
43 class CORE_EXPORT
Command :
public QObject
49 CA_UpdateText = 0x0200,
50 CA_UpdateIcon = 0x0400,
51 CA_NonConfigureable = 0x8000,
55 virtual void setDefaultKeySequence(
const QKeySequence &key) = 0;
56 virtual QKeySequence defaultKeySequence()
const = 0;
57 virtual QKeySequence keySequence()
const = 0;
58 virtual void setDefaultText(
const QString &text) = 0;
59 virtual QString defaultText()
const = 0;
61 virtual int id()
const = 0;
63 virtual QAction *action()
const = 0;
64 virtual QShortcut *shortcut()
const = 0;
66 virtual void setAttribute(CommandAttribute attr) = 0;
67 virtual void removeAttribute(CommandAttribute attr) = 0;
68 virtual bool hasAttribute(CommandAttribute attr)
const = 0;
70 virtual bool isActive()
const = 0;
74 virtual void setKeySequence(
const QKeySequence &key) = 0;
76 virtual QString stringWithAppendedShortcut(
const QString &str)
const = 0;
79 void keySequenceChanged();
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.