KDEUI
kaction.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #ifndef KACTION_H
00027 #define KACTION_H
00028
00029 #include <kdeui_export.h>
00030 #include <kguiitem.h>
00031 #include <kshortcut.h>
00032
00033 #include <QtGui/QWidgetAction>
00034
00035 class KIcon;
00036 class KShapeGesture;
00037 class KRockerGesture;
00038
00039
00040
00211 class KDEUI_EXPORT KAction : public QWidgetAction
00212 {
00213 Q_OBJECT
00214
00215 Q_PROPERTY( KShortcut shortcut READ shortcut WRITE setShortcut )
00216 Q_PROPERTY( bool shortcutConfigurable READ isShortcutConfigurable WRITE setShortcutConfigurable )
00217 Q_PROPERTY( KShortcut globalShortcut READ globalShortcut WRITE setGlobalShortcut )
00218 Q_PROPERTY( bool globalShortcutAllowed READ globalShortcutAllowed WRITE setGlobalShortcutAllowed )
00219 Q_PROPERTY( bool globalShortcutEnabled READ isGlobalShortcutEnabled )
00220 Q_FLAGS( ShortcutType )
00221
00222 public:
00226 enum ShortcutType {
00228 ActiveShortcut = 0x1,
00231 DefaultShortcut = 0x2
00232 };
00233 Q_DECLARE_FLAGS(ShortcutTypes, ShortcutType)
00234
00235
00238
00239
00240 enum GlobalShortcutLoading {
00244 Autoloading = 0x0,
00246 NoAutoloading = 0x4
00247 };
00251 explicit KAction(QObject *parent);
00252
00259 KAction(const QString& text, QObject *parent);
00260
00272 KAction(const KIcon& icon, const QString& text, QObject *parent);
00273
00277 virtual ~KAction();
00278
00296 void setHelpText(const QString& text);
00297
00309 KShortcut shortcut(ShortcutTypes types = ActiveShortcut) const;
00310
00321 void setShortcut(const KShortcut& shortcut, ShortcutTypes type = ShortcutTypes(ActiveShortcut | DefaultShortcut));
00322
00335 void setShortcut(const QKeySequence& shortcut, ShortcutTypes type = ShortcutTypes(ActiveShortcut | DefaultShortcut));
00336
00349 void setShortcuts(const QList<QKeySequence>& shortcuts, ShortcutTypes type = ShortcutTypes(ActiveShortcut | DefaultShortcut));
00350
00354 bool isShortcutConfigurable() const;
00355
00361 void setShortcutConfigurable(bool configurable);
00362
00376 const KShortcut& globalShortcut(ShortcutTypes type = ActiveShortcut) const;
00377
00414 void setGlobalShortcut(const KShortcut& shortcut, ShortcutTypes type =
00415 ShortcutTypes(ActiveShortcut | DefaultShortcut),
00416 GlobalShortcutLoading loading = Autoloading);
00417
00423 KDE_DEPRECATED bool globalShortcutAllowed() const;
00424
00433 KDE_DEPRECATED void setGlobalShortcutAllowed(bool allowed, GlobalShortcutLoading loading = Autoloading);
00434
00440 bool isGlobalShortcutEnabled() const;
00441
00451 void forgetGlobalShortcut();
00452
00453 KShapeGesture shapeGesture(ShortcutTypes type = ActiveShortcut) const;
00454 KRockerGesture rockerGesture(ShortcutTypes type = ActiveShortcut) const;
00455
00456 void setShapeGesture(const KShapeGesture& gest, ShortcutTypes type = ShortcutTypes(ActiveShortcut | DefaultShortcut));
00457 void setRockerGesture(const KRockerGesture& gest, ShortcutTypes type = ShortcutTypes(ActiveShortcut | DefaultShortcut));
00458
00462 bool event(QEvent*);
00463
00464
00465 Q_SIGNALS:
00466 #ifdef KDE3_SUPPORT
00467
00472 QT_MOC_COMPAT void activated();
00473 #endif
00474
00479 void triggered(Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers);
00480
00485 void globalShortcutChanged(const QKeySequence&);
00486
00487 private:
00488 friend class KGlobalAccelPrivate;
00489 friend class KActionCollectionPrivate;
00490 friend class KShortcutsEditorDelegate;
00491 Q_PRIVATE_SLOT(d, void slotTriggered())
00492 class KActionPrivate* const d;
00493 friend class KActionPrivate;
00494 friend class KGlobalShortcutTest;
00495 };
00496
00497 Q_DECLARE_OPERATORS_FOR_FLAGS(KAction::ShortcutTypes)
00498
00499 #endif