dRonin  adbada4
dRonin GCS
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Groups Pages
command.h
Go to the documentation of this file.
1 
13 /*
14  * This program is free software; you can redistribute it and/or modify
15  * it under the terms of the GNU General Public License as published by
16  * the Free Software Foundation; either version 3 of the License, or
17  * (at your option) any later version.
18  *
19  * This program is distributed in the hope that it will be useful, but
20  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
21  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  * for more details.
23  *
24  * You should have received a copy of the GNU General Public License along
25  * with this program; if not, see <http://www.gnu.org/licenses/>
26  */
27 
28 #ifndef COMMAND_H
29 #define COMMAND_H
30 
31 #include <coreplugin/core_global.h>
32 
33 #include <QtCore/QObject>
34 
35 QT_BEGIN_NAMESPACE
36 class QAction;
37 class QShortcut;
38 class QKeySequence;
39 QT_END_NAMESPACE
40 
41 namespace Core {
42 
43 class CORE_EXPORT Command : public QObject
44 {
45  Q_OBJECT
46 public:
48  CA_Hide = 0x0100,
49  CA_UpdateText = 0x0200,
50  CA_UpdateIcon = 0x0400,
51  CA_NonConfigureable = 0x8000,
52  CA_Mask = 0xFF00
53  };
54 
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;
60 
61  virtual int id() const = 0;
62 
63  virtual QAction *action() const = 0;
64  virtual QShortcut *shortcut() const = 0;
65 
66  virtual void setAttribute(CommandAttribute attr) = 0;
67  virtual void removeAttribute(CommandAttribute attr) = 0;
68  virtual bool hasAttribute(CommandAttribute attr) const = 0;
69 
70  virtual bool isActive() const = 0;
71 
72  virtual ~Command() {}
73 
74  virtual void setKeySequence(const QKeySequence &key) = 0;
75 
76  virtual QString stringWithAppendedShortcut(const QString &str) const = 0;
77 
78 signals:
79  void keySequenceChanged();
80 };
81 
82 } // namespace Core
83 
84 #endif // COMMAND_H
virtual ~Command()
Definition: command.h:72
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.
Definition: command.h:43