KXmlGui

kkeysequencewidget.h
1 /*
2  This file is part of the KDE libraries
3  SPDX-FileCopyrightText: 2001, 2002 Ellis Whitehead <[email protected]>
4  SPDX-FileCopyrightText: 2007 Andreas Hartmetz <[email protected]>
5 
6  SPDX-License-Identifier: LGPL-2.0-or-later
7 */
8 
9 #ifndef KKEYSEQUENCEWIDGET_H
10 #define KKEYSEQUENCEWIDGET_H
11 
12 #include <kxmlgui_export.h>
13 
14 #include <QList>
15 #include <QPushButton>
16 
17 class KKeySequenceWidgetPrivate;
18 class QAction;
19 class KActionCollection;
20 
37 class KXMLGUI_EXPORT KKeySequenceWidget: public QWidget
38 {
39  Q_OBJECT
40 
42  Q_PROPERTY(
43  QKeySequence keySequence
44  READ keySequence
45  WRITE setKeySequence
46  NOTIFY keySequenceChanged)
47 
48  Q_PROPERTY(
49  bool multiKeyShortcutsAllowed
50  READ multiKeyShortcutsAllowed
51  WRITE setMultiKeyShortcutsAllowed)
52 
53  Q_PROPERTY(
54  ShortcutTypes checkForConflictsAgainst
55  READ checkForConflictsAgainst
56  WRITE setCheckForConflictsAgainst)
57 
58  Q_PROPERTY(
59  bool modifierlessAllowed
60  READ isModifierlessAllowed
61  WRITE setModifierlessAllowed)
62 
63 public:
66  enum Validation {
68  Validate = 0,
70  NoValidate = 1
71  };
72 
76  explicit KKeySequenceWidget(QWidget *parent = nullptr);
77 
81  virtual ~KKeySequenceWidget();
82 
90 
91  enum ShortcutType {
92  None = 0x00,
93  LocalShortcuts = 0x01,
94  StandardShortcuts = 0x02,
95  GlobalShortcuts = 0x04
96  };
100  Q_DECLARE_FLAGS(ShortcutTypes, ShortcutType)
101  Q_FLAG(ShortcutTypes)
102 
157  void setCheckForConflictsAgainst(ShortcutTypes types);
158 
165  ShortcutTypes checkForConflictsAgainst() const;
166 
170  void setMultiKeyShortcutsAllowed(bool);
171  bool multiKeyShortcutsAllowed() const;
172 
180  void setModifierlessAllowed(bool allow);
181 
185  bool isModifierlessAllowed();
186 
191  void setClearButtonShown(bool show);
192 
194 
204  bool isKeySequenceAvailable(const QKeySequence &seq) const;
205 
209  QKeySequence keySequence() const;
210 
223  void setCheckActionCollections(const QList<KActionCollection *> &actionCollections);
224 
225 #if KXMLGUI_ENABLE_DEPRECATED_SINCE(4, 1)
226 
232  KXMLGUI_DEPRECATED_VERSION(4, 1, "Use KKeySequenceWidget::setCheckActionCollections(const QList<KActionCollection *> &)")
233  void setCheckActionList(const QList<QAction *> &checkList);
234 #endif
235 
240  void setComponentName(const QString &componentName);
241 
242 Q_SIGNALS:
243 
248  void keySequenceChanged(const QKeySequence &seq);
249 
259  void stealShortcut(const QKeySequence &seq, QAction *action);
260 
261 public Q_SLOTS:
262 
270  void captureKeySequence();
271 
278  void setKeySequence(const QKeySequence &seq, Validation val = NoValidate);
279 
283  void clearKeySequence();
284 
297  void applyStealShortcut();
298 
299 private:
300  Q_PRIVATE_SLOT(d, void doneRecording())
301 
302 private:
303  friend class KKeySequenceWidgetPrivate;
304  KKeySequenceWidgetPrivate *const d;
305 
306  Q_DISABLE_COPY(KKeySequenceWidget)
307 };
308 
309 Q_DECLARE_OPERATORS_FOR_FLAGS(KKeySequenceWidget::ShortcutTypes)
310 
311 #endif //KKEYSEQUENCEWIDGET_H
A widget to input a QKeySequence.
A container for a set of QAction objects.
Validation
An enum about validation when setting a key sequence.
Q_PROPERTY(...)
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Wed Aug 12 2020 22:50:46 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.