• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdelibs-4.14.38 API Reference
  • KDE Home
  • Contact Us
 

KDEUI

  • kdeui
  • actions
kaction.h
Go to the documentation of this file.
1/* This file is part of the KDE libraries
2 Copyright (C) 1999 Reginald Stadlbauer <reggie@kde.org>
3 (C) 1999 Simon Hausmann <hausmann@kde.org>
4 (C) 2000 Nicolas Hadacek <haadcek@kde.org>
5 (C) 2000 Kurt Granroth <granroth@kde.org>
6 (C) 2000 Michael Koch <koch@kde.org>
7 (C) 2001 Holger Freyther <freyther@kde.org>
8 (C) 2002 Ellis Whitehead <ellis@kde.org>
9 (C) 2005-2006 Hamish Rodda <rodda@kde.org>
10
11 This library is free software; you can redistribute it and/or
12 modify it under the terms of the GNU Library General Public
13 License version 2 as published by the Free Software Foundation.
14
15 This library is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 Library General Public License for more details.
19
20 You should have received a copy of the GNU Library General Public License
21 along with this library; see the file COPYING.LIB. If not, write to
22 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
23 Boston, MA 02110-1301, USA.
24*/
25
26#ifndef KACTION_H
27#define KACTION_H
28
29#include <kdeui_export.h>
30#include <kguiitem.h>
31#include <kshortcut.h>
32
33#include <QtGui/QWidgetAction>
34
35class KIcon;
36class KShapeGesture;
37class KRockerGesture;
38
39namespace KAuth {
40 class Action;
41}
42
43//TODO Reduce the word count. This is not very focused and takes too long to read.
44//Keep in mind that QAction also has documentation that we don't need to repeat here.
216class KDEUI_EXPORT KAction : public QWidgetAction
217{
218 Q_OBJECT
219
220 Q_PROPERTY( KShortcut shortcut READ shortcut WRITE setShortcut )
221 Q_PROPERTY( bool shortcutConfigurable READ isShortcutConfigurable WRITE setShortcutConfigurable )
222 Q_PROPERTY( KShortcut globalShortcut READ globalShortcut WRITE setGlobalShortcut )
223#ifndef KDE_NO_DEPRECATED
224 Q_PROPERTY( bool globalShortcutAllowed READ globalShortcutAllowed WRITE setGlobalShortcutAllowed )
225#endif
226 Q_PROPERTY( bool globalShortcutEnabled READ isGlobalShortcutEnabled )
227 Q_FLAGS( ShortcutType )
228
229public:
233 enum ShortcutType {
235 ActiveShortcut = 0x1,
238 DefaultShortcut = 0x2
239 };
240 Q_DECLARE_FLAGS(ShortcutTypes, ShortcutType)
241
242
245 //This enum will be ORed with ShortcutType in calls to KGlobalAccel, so it must not contain
246 //any value equal to a value in ShortcutType.
247 enum GlobalShortcutLoading {
251 Autoloading = 0x0,
253 NoAutoloading = 0x4
254 };
258 explicit KAction(QObject *parent);
259
266 KAction(const QString& text, QObject *parent);
267
279 KAction(const KIcon& icon, const QString& text, QObject *parent);
280
284 virtual ~KAction();
285
303 void setHelpText(const QString& text);
304
316 KShortcut shortcut(ShortcutTypes types = ActiveShortcut) const;
317
328 void setShortcut(const KShortcut& shortcut, ShortcutTypes type = ShortcutTypes(ActiveShortcut | DefaultShortcut));
329
342 void setShortcut(const QKeySequence& shortcut, ShortcutTypes type = ShortcutTypes(ActiveShortcut | DefaultShortcut));
343
356 void setShortcuts(const QList<QKeySequence>& shortcuts, ShortcutTypes type = ShortcutTypes(ActiveShortcut | DefaultShortcut));
357
361 bool isShortcutConfigurable() const;
362
368 void setShortcutConfigurable(bool configurable);
369
383 const KShortcut& globalShortcut(ShortcutTypes type = ActiveShortcut) const;
384
421 void setGlobalShortcut(const KShortcut& shortcut, ShortcutTypes type =
422 ShortcutTypes(ActiveShortcut | DefaultShortcut),
423 GlobalShortcutLoading loading = Autoloading);
424
430#ifndef KDE_NO_DEPRECATED
431 KDE_DEPRECATED bool globalShortcutAllowed() const;
432#endif
433
442#ifndef KDE_NO_DEPRECATED
443 KDE_DEPRECATED void setGlobalShortcutAllowed(bool allowed, GlobalShortcutLoading loading = Autoloading);
444#endif
445
451 bool isGlobalShortcutEnabled() const;
452
462 void forgetGlobalShortcut();
463
464 KShapeGesture shapeGesture(ShortcutTypes type = ActiveShortcut) const;
465 KRockerGesture rockerGesture(ShortcutTypes type = ActiveShortcut) const;
466
467 void setShapeGesture(const KShapeGesture& gest, ShortcutTypes type = ShortcutTypes(ActiveShortcut | DefaultShortcut));
468 void setRockerGesture(const KRockerGesture& gest, ShortcutTypes type = ShortcutTypes(ActiveShortcut | DefaultShortcut));
469
475 KAuth::Action *authAction() const;
476
487 void setAuthAction(KAuth::Action *action);
488
496 void setAuthAction(const QString &actionName);
497
501 bool event(QEvent*);
502
503
504Q_SIGNALS:
505#ifdef KDE3_SUPPORT
511 QT_MOC_COMPAT void activated();
512#endif
513
518 void triggered(Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers);
519
535 void authorized(KAuth::Action *action);
536
541 void globalShortcutChanged(const QKeySequence&);
542
543private:
544 friend class KGlobalAccelPrivate; // Needs access to the component
545 friend class KActionCollectionPrivate; // Needs access to the component
546 friend class KShortcutsEditorDelegate; // Needs access to the component
547 Q_PRIVATE_SLOT(d, void slotTriggered())
548 Q_PRIVATE_SLOT(d, void authStatusChanged(int))
549 class KActionPrivate* const d;
550 friend class KActionPrivate;
551 friend class KGlobalShortcutTest;
552};
553
554Q_DECLARE_OPERATORS_FOR_FLAGS(KAction::ShortcutTypes)
555
556#endif
KAction
Class to encapsulate user-driven action or event.
Definition: kaction.h:217
KAction::GlobalShortcutLoading
GlobalShortcutLoading
An enum about global shortcut setter semantics.
Definition: kaction.h:247
KAction::authorized
void authorized(KAuth::Action *action)
Signal emitted when the action is triggered and authorized.
KAction::triggered
void triggered(Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers)
Emitted when the action is triggered.
KAction::globalShortcutChanged
void globalShortcutChanged(const QKeySequence &)
Emitted when the global shortcut is changed.
KAction::ShortcutType
ShortcutType
An enumeration about the two types of shortcuts in a KAction.
Definition: kaction.h:233
KAuth::Action
KIcon
A wrapper around QIcon that provides KDE icon features.
Definition: kicon.h:41
KRockerGesture
Definition: kgesture.h:153
KShapeGesture
Definition: kgesture.h:38
KShortcut
Represents a keyboard shortcut.
Definition: kshortcut.h:58
QList
QObject
QWidgetAction
kdeui_export.h
kguiitem.h
kshortcut.h
Defines platform-independent classes for keyboard shortcut handling.
KAuth
Action
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by doxygen 1.9.6 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KDEUI

Skip menu "KDEUI"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules
  • Related Pages

kdelibs-4.14.38 API Reference

Skip menu "kdelibs-4.14.38 API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal