Krita Source Code Documentation
Loading...
Searching...
No Matches
KisShortcutsEditor.h
Go to the documentation of this file.
1/* This file is part of the KDE libraries
2 SPDX-FileCopyrightText: 1997 Nicolas Hadacek <hadacek@kde.org>
3 SPDX-FileCopyrightText: 2001, 2001 Ellis Whitehead <ellis@kde.org>
4 SPDX-FileCopyrightText: 2006 Hamish Rodda <rodda@kde.org>
5 SPDX-FileCopyrightText: 2007 Roberto Raggi <roberto@kdevelop.org>
6 SPDX-FileCopyrightText: 2007 Andreas Hartmetz <ahartmetz@gmail.com>
7 SPDX-FileCopyrightText: 2008 Michael Jansen <kde@michael-jansen.biz>
8 SPDX-FileCopyrightText: 2015 Michael Abrahams <miabraha@gmail.com>
9
10
11 SPDX-License-Identifier: LGPL-2.0-or-later
12*/
13
14#ifndef KISSHORTCUTSEDITOR_H
15#define KISSHORTCUTSEDITOR_H
16
17#include <kritawidgetutils_export.h>
18
19#include <QWidget>
20#include <KisKineticScroller.h>
21
23class KConfig;
24class KConfigBase;
25class KConfigGroup;
26class KGlobalAccel;
28
29
55class KRITAWIDGETUTILS_EXPORT KisShortcutsEditor : public QWidget
56{
57 Q_OBJECT
58 Q_PROPERTY(ActionTypes actionTypes READ actionTypes WRITE setActionTypes)
59
60public:
61 /*
62 * These attempt to build some sort of characterization of all actions. The
63 * idea is to determine which sorts of actions will be configured in the
64 * dialog.
65 *
66 * Enumerating all possible actions is a sorrowful, pitiable endeavor,
67 * useless for Krita. We should do something about this.
68 */
71 WidgetAction = Qt::WidgetShortcut /*0*/,
73 WindowAction = Qt::WindowShortcut /*1*/,
75 ApplicationAction = Qt::ApplicationShortcut /*2*/,
77 GlobalAction = 4,
79 AllActions = 0xffffffff
80 };
81 Q_DECLARE_FLAGS(ActionTypes, ActionType)
82
87 LetterShortcutsDisallowed = 0,
89 LetterShortcutsAllowed
90 };
91
102 explicit KisShortcutsEditor(QWidget *parent,
103 ActionTypes actionTypes = AllActions, LetterShortcuts allowLetterShortcuts = LetterShortcutsAllowed);
104
106 ~KisShortcutsEditor() override;
107
111 bool isModified() const;
112
116 void clearCollections();
117
121 void clearSearch();
122
135 void addCollection(KisKActionCollection *, const QString &title = QString());
136
140 void undo();
141
150 void save();
151
157 void commit();
158
162 void clearConfiguration();
163
170 void saveShortcuts(KConfigGroup *config = 0) const;
171
172
178 void exportConfiguration(KConfigBase *config) const;
179
180
187 void importConfiguration(KConfigBase *config, bool isScheme);
188
195 void setActionTypes(ActionTypes actionTypes);
201 ActionTypes actionTypes() const;
202
203Q_SIGNALS:
207 void keyChange();
208
209public Q_SLOTS:
213 void resizeColumns();
214
218 void allDefault();
219
223 void printShortcuts() const;
224
228 void searchUpdated(QString s);
229
230 void slotScrollerStateChanged(QScroller::State state){KisKineticScroller::updateCursor(this, state);}
231
232private:
233 Q_PRIVATE_SLOT(d, void capturedShortcut(QVariant, const QModelIndex &))
234
235private:
236 friend class KisShortcutsDialog;
239 Q_DISABLE_COPY(KisShortcutsEditor)
240};
241
242Q_DECLARE_OPERATORS_FOR_FLAGS(KisShortcutsEditor::ActionTypes)
243
244#endif // KISSHORTCUTSEDITOR_H
Q_DECLARE_FLAGS(KisUpdaterContextSnapshotEx, KisUpdaterContextSnapshotExTag)
A container for a set of QAction objects.
Widget for configuration of KAccel and KGlobalAccel.
void slotScrollerStateChanged(QScroller::State state)
KisShortcutsEditorPrivate *const d
Q_DECLARE_OPERATORS_FOR_FLAGS(KisBaseRectsWalker::SubtreeVisitFlags)
KRITAWIDGETUTILS_EXPORT void updateCursor(QWidget *source, QScroller::State state)