File indexing completed on 2024-05-12 03:54:28
0001 /* 0002 SPDX-FileCopyrightText: 2022 David Redondo <kde@david-redondo.de> 0003 0004 SPDX-License-Identifier: LGPL-2.0-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL 0005 */ 0006 0007 #ifndef KSTANDARDSHORTCUTWATCHER_H 0008 #define KSTANDARDSHORTCUTWATCHER_H 0009 0010 #include "kstandardshortcut.h" 0011 0012 #include <QObject> 0013 0014 #include <memory> 0015 0016 #include <kconfiggui_export.h> 0017 0018 namespace KStandardShortcut 0019 { 0020 class StandardShortcutWatcherPrivate; 0021 0022 /** 0023 * Watches for changes made to standard shortcuts and notifies about those changes. 0024 * @see KStandardShortcut::shortcutWatcher 0025 * @since 5.91 0026 */ 0027 class KCONFIGGUI_EXPORT StandardShortcutWatcher : public QObject 0028 { 0029 Q_OBJECT 0030 public: 0031 ~StandardShortcutWatcher(); 0032 Q_SIGNALS: 0033 /** 0034 * The standardshortcut @p id was changed to @p shortcut 0035 */ 0036 void shortcutChanged(KStandardShortcut::StandardShortcut id, const QList<QKeySequence> &shortcut); 0037 0038 private: 0039 KCONFIGGUI_NO_EXPORT explicit StandardShortcutWatcher(QObject *parent = nullptr); 0040 0041 friend KCONFIGGUI_EXPORT StandardShortcutWatcher *shortcutWatcher(); 0042 std::unique_ptr<StandardShortcutWatcherPrivate> d; 0043 }; 0044 0045 /** 0046 * Returns the global KStandardShortcutWatcher instance of this program. 0047 * In addition to the notifying about changes it also keeps the information returned by the 0048 * functions in @p KStandardShortcut up to date. 0049 * The object is created by the first call to this function. 0050 * @since 5.91 0051 */ 0052 KCONFIGGUI_EXPORT StandardShortcutWatcher *shortcutWatcher(); 0053 } 0054 0055 #endif