KXmlGui

kshortcutwidget.h
1/*
2 This file is part of the KDE libraries
3 SPDX-FileCopyrightText: 2007 Andreas Hartmetz <ahartmetz@gmail.com>
4
5 SPDX-License-Identifier: LGPL-2.0-or-later
6*/
7#ifndef KSHORTCUTWIDGET_H
8#define KSHORTCUTWIDGET_H
9
10#include <kxmlgui_export.h>
11
12#include <QKeySequence>
13#include <QList>
14#include <QWidget>
15#include <memory>
16
18class KShortcutWidgetPrivate;
19
20/**
21 * @class KShortcutWidget kshortcutwidget.h KShortcutWidget
22 *
23 * \image html kshortcutwidget.png "KShortcutWidget"
24 */
25class KXMLGUI_EXPORT KShortcutWidget : public QWidget
26{
27 Q_OBJECT
28 Q_PROPERTY(bool modifierlessAllowed READ isModifierlessAllowed WRITE setModifierlessAllowed)
29public:
30 explicit KShortcutWidget(QWidget *parent = nullptr);
31 ~KShortcutWidget() override;
32
33 void setModifierlessAllowed(bool allow);
34 bool isModifierlessAllowed();
35
36 void setClearButtonsShown(bool show);
37
38 QList<QKeySequence> shortcut() const;
39
40 /**
41 * Set a list of action collections to check against for conflictuous shortcut.
42 *
43 * If there is a conflictuous shortcut with a QAction, and that his shortcut can be configured
44 * (KActionCollection::isShortcutConfigurable() returns true) the user will be prompted for eventually steal
45 * the shortcut from this action
46 *
47 * Global shortcuts are automatically checked for conflicts
48 *
49 * Don't forget to call applyStealShortcut to actually steal the shortcut.
50 *
51 * @since 4.1
52 */
53 void setCheckActionCollections(const QList<KActionCollection *> &actionCollections);
54
56 void shortcutChanged(const QList<QKeySequence> &cut);
57
58public Q_SLOTS:
59 void setShortcut(const QList<QKeySequence> &cut);
60 void clearShortcut();
61
62 /**
63 * Actually remove the shortcut that the user wanted to steal, from the
64 * action that was using it.
65 *
66 * To be called before you apply your changes.
67 * No shortcuts are stolen until this function is called.
68 */
69 void applyStealShortcut();
70
71private:
72 friend class KShortcutWidgetPrivate;
73 std::unique_ptr<KShortcutWidgetPrivate> const d;
74};
75
76#endif // KSHORTCUTWIDGET_H
A container for a set of QAction objects.
Q_PROPERTY(...)
Q_SIGNALSQ_SIGNALS
Q_SLOTSQ_SLOTS
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 22 2024 12:02:25 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.