KXmlGui

kshortcutseditor.h
1 /*
2  This file is part of the KDE libraries
3  SPDX-FileCopyrightText: 1997 Nicolas Hadacek <[email protected]>
4  SPDX-FileCopyrightText: 2001, 2001 Ellis Whitehead <[email protected]>
5  SPDX-FileCopyrightText: 2006 Hamish Rodda <[email protected]>
6  SPDX-FileCopyrightText: 2007 Roberto Raggi <[email protected]>
7  SPDX-FileCopyrightText: 2007 Andreas Hartmetz <[email protected]>
8  SPDX-FileCopyrightText: 2008 Michael Jansen <[email protected]>
9 
10  SPDX-License-Identifier: LGPL-2.0-or-later
11 */
12 
13 #ifndef KSHORTCUTSEDITOR_H
14 #define KSHORTCUTSEDITOR_H
15 
16 #include <kxmlgui_export.h>
17 
18 #include <QWidget>
19 
20 class KActionCollection;
21 class KConfig;
22 class KConfigBase;
23 class KConfigGroup;
24 class KGlobalAccel;
25 class KShortcutsEditorPrivate;
26 
27 // KShortcutsEditor expects that the list of existing shortcuts is already
28 // free of conflicts. If it is not, nothing will crash, but your users
29 // won't like the resulting behavior.
30 
49 class KXMLGUI_EXPORT KShortcutsEditor : public QWidget
50 {
51  Q_OBJECT
52  Q_PROPERTY(ActionTypes actionTypes READ actionTypes WRITE setActionTypes)
53 
54 public:
58  enum ActionType {
60  WidgetAction = Qt::WidgetShortcut /*0*/,
62  WindowAction = Qt::WindowShortcut /*1*/,
64  ApplicationAction = Qt::ApplicationShortcut /*2*/,
66  GlobalAction = 4,
68  AllActions = 0xffffffff
69  };
73  Q_DECLARE_FLAGS(ActionTypes, ActionType)
74 
80  LetterShortcutsDisallowed = 0,
82  LetterShortcutsAllowed
83  };
84 
94  KShortcutsEditor(KActionCollection *collection, QWidget *parent, ActionTypes actionTypes = AllActions, LetterShortcuts allowLetterShortcuts = LetterShortcutsAllowed);
95 
106  explicit KShortcutsEditor(QWidget *parent, ActionTypes actionTypes = AllActions, LetterShortcuts allowLetterShortcuts = LetterShortcutsAllowed);
107 
109  virtual ~KShortcutsEditor();
110 
114  bool isModified() const;
115 
119  void clearCollections();
120 
126  void addCollection(KActionCollection *, const QString &title = QString());
127 
133  void undo();
134 
135 #if KXMLGUI_ENABLE_DEPRECATED_SINCE(5, 75)
136 
140  KXMLGUI_DEPRECATED_VERSION(5, 75, "Use KShortcutsEditor::undo()")
141  void undoChanges();
142 #endif
143 
152  void save();
153 
161  void commit();
162 
166  void clearConfiguration();
167 
182  void writeConfiguration(KConfigGroup *config = nullptr) const;
183 
192  void exportConfiguration(KConfigBase *config) const;
193 #if KXMLGUI_ENABLE_DEPRECATED_SINCE(5, 0)
194  KXMLGUI_DEPRECATED_VERSION(5, 0, "Use KShortcutsEditor::exportConfiguration(KConfigBase *config)")
195  void exportConfiguration(KConfig *config) const;
196 #endif
197 
206  void importConfiguration(KConfigBase *config);
207 #if KXMLGUI_ENABLE_DEPRECATED_SINCE(5, 0)
208  KXMLGUI_DEPRECATED_VERSION(5, 0, "Use KShortcutsEditor::importConfiguration(KConfigBase *config)")
209  void importConfiguration(KConfig *config);
210 #endif
211 
218  void setActionTypes(ActionTypes actionTypes);
224  ActionTypes actionTypes() const;
225 
226 Q_SIGNALS:
230  void keyChange();
231 
232 public Q_SLOTS:
236  void resizeColumns();
237 
241  void allDefault();
242 
246  void printShortcuts() const;
247 
248 private:
249  Q_PRIVATE_SLOT(d, void capturedShortcut(QVariant, const QModelIndex &))
250 
251 private:
252  friend class KShortcutsDialog;
253  friend class KShortcutsEditorPrivate;
254  std::unique_ptr<KShortcutsEditorPrivate> const d;
255  Q_DISABLE_COPY(KShortcutsEditor)
256 };
257 
258 Q_DECLARE_OPERATORS_FOR_FLAGS(KShortcutsEditor::ActionTypes)
259 
260 #endif // KSHORTCUTSEDITOR_H
A container for a set of QAction objects.
WidgetShortcut
Widget for configuration of KAccel and KGlobalAccel.
Q_PROPERTY(...)
Dialog for configuration of KActionCollection and KGlobalAccel.
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Sat Jan 23 2021 03:01:10 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.