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
00207 class KDEUI_EXPORT KAction : public QWidgetAction
00208 {
00209 Q_OBJECT
00210
00211 Q_PROPERTY( KShortcut shortcut READ shortcut WRITE setShortcut )
00212 Q_PROPERTY( bool shortcutConfigurable READ isShortcutConfigurable WRITE setShortcutConfigurable )
00213 Q_PROPERTY( KShortcut globalShortcut READ globalShortcut WRITE setGlobalShortcut )
00214 Q_PROPERTY( bool globalShortcutAllowed READ globalShortcutAllowed WRITE setGlobalShortcutAllowed )
00215 Q_PROPERTY( bool globalShortcutEnabled READ isGlobalShortcutEnabled )
00216 Q_FLAGS( ShortcutType )
00217
00218 public:
00222 enum ShortcutType {
00224 ActiveShortcut = 0x1,
00227 DefaultShortcut = 0x2
00228 };
00229 Q_DECLARE_FLAGS(ShortcutTypes, ShortcutType)
00230
00231
00234
00235
00236 enum GlobalShortcutLoading {
00240 Autoloading = 0x0,
00242 NoAutoloading = 0x4
00243 };
00247 explicit KAction(QObject *parent);
00248
00255 KAction(const QString& text, QObject *parent);
00256
00268 KAction(const KIcon& icon, const QString& text, QObject *parent);
00269
00273 virtual ~KAction();
00274
00286 KShortcut shortcut(ShortcutTypes types = ActiveShortcut) const;
00287
00298 void setShortcut(const KShortcut& shortcut, ShortcutTypes type = ShortcutTypes(ActiveShortcut | DefaultShortcut));
00299
00312 void setShortcut(const QKeySequence& shortcut, ShortcutTypes type = ShortcutTypes(ActiveShortcut | DefaultShortcut));
00313
00326 void setShortcuts(const QList<QKeySequence>& shortcuts, ShortcutTypes type = ShortcutTypes(ActiveShortcut | DefaultShortcut));
00327
00331 bool isShortcutConfigurable() const;
00332
00338 void setShortcutConfigurable(bool configurable);
00339
00353 const KShortcut& globalShortcut(ShortcutTypes type = ActiveShortcut) const;
00354
00391 void setGlobalShortcut(const KShortcut& shortcut, ShortcutTypes type =
00392 ShortcutTypes(ActiveShortcut | DefaultShortcut),
00393 GlobalShortcutLoading loading = Autoloading);
00394
00400 KDE_DEPRECATED bool globalShortcutAllowed() const;
00401
00410 KDE_DEPRECATED void setGlobalShortcutAllowed(bool allowed, GlobalShortcutLoading loading = Autoloading);
00411
00417 bool isGlobalShortcutEnabled() const;
00418
00428 void forgetGlobalShortcut();
00429
00430 KShapeGesture shapeGesture(ShortcutTypes type = ActiveShortcut) const;
00431 KRockerGesture rockerGesture(ShortcutTypes type = ActiveShortcut) const;
00432
00433 void setShapeGesture(const KShapeGesture& gest, ShortcutTypes type = ShortcutTypes(ActiveShortcut | DefaultShortcut));
00434 void setRockerGesture(const KRockerGesture& gest, ShortcutTypes type = ShortcutTypes(ActiveShortcut | DefaultShortcut));
00435
00436 Q_SIGNALS:
00437 #ifdef KDE3_SUPPORT
00438
00443 QT_MOC_COMPAT void activated();
00444 #endif
00445
00450 void triggered(Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers);
00451
00452 private:
00453 friend class KGlobalAccelPrivate;
00454 friend class KActionCollectionPrivate;
00455 Q_PRIVATE_SLOT(d, void slotTriggered())
00456 class KActionPrivate* const d;
00457 friend class KActionPrivate;
00458 friend class KGlobalShortcutTest;
00459 };
00460
00461 Q_DECLARE_OPERATORS_FOR_FLAGS(KAction::ShortcutTypes)
00462
00463 #endif