Krita Source Code Documentation
Loading...
Searching...
No Matches
kis_shortcut_configuration.h
Go to the documentation of this file.
1/*
2 * This file is part of the KDE project
3 * SPDX-FileCopyrightText: 2013 Arjen Hiemstra <ahiemstra@heimr.nl>
4 *
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 */
7
8#ifndef KISSHORTCUTCONFIGURATION_H
9#define KISSHORTCUTCONFIGURATION_H
10
11#include <kritaui_export.h>
12
13#include <QList>
14#include <QMetaType>
15
16class QString;
18
29class KRITAUI_EXPORT KisShortcutConfiguration
30{
31public:
43
55
74
76 NoNativeGesture = 0,
77 PinchGesture = 1,
78
79 // WARNING: elements with indexes 1 and 2 are intentionally skipped,
80 // they used to represent Qt::PanNativeGesture and Qt::RotateNativeGesture,
81 // but now all three gestures are represented as a single PinchGesture.
82
83 SmartZoomGesture = 4,
84 TouchpadScroll = 5,
86 };
87
100
108 bool operator==(const KisShortcutConfiguration &other) const;
109
114
127 QString serialize();
139 bool unserialize(const QString &serialized);
140
144 KisAbstractInputAction *action() const;
150 void setAction(KisAbstractInputAction *newAction);
151
155 ShortcutType type() const;
161 void setType(ShortcutType newType);
162
166 uint mode() const;
172 void setMode(uint newMode);
173
179 QList<Qt::Key> keys() const;
187 void setKeys(const QList<Qt::Key> &newKeys);
188
194 Qt::MouseButtons buttons() const;
202 void setButtons(Qt::MouseButtons newButtons);
203
209 MouseWheelMovement wheel() const;
217 void setWheel(MouseWheelMovement type);
218
224 TouchGestureAction touchGesture() const;
225
233 void setTouchGesture(TouchGestureAction type);
234
240 NativeGestureAction nativeGesture() const;
241
249 void setNativeGesture(NativeGestureAction type);
250
255 bool isNoOp() const;
256
260 QString getInputText() const;
261
278 static QString buttonsToText(Qt::MouseButtons buttons);
294 static QString keysToText(const QList<Qt::Key> &keys);
309 static QString wheelToText(MouseWheelMovement wheel);
327 static QString buttonsInputToText(const QList<Qt::Key> &keys, Qt::MouseButtons buttons);
346 static QString wheelInputToText(const QList<Qt::Key> &keys, MouseWheelMovement wheel);
347
348 static QString touchGestureToText(TouchGestureAction action);
349 static QString nativeGestureToText(NativeGestureAction action);
350 static QString shortcutTypeToText(ShortcutType type);
351
352private:
353 class Private;
354 Private *const d;
355};
356
358
359#endif // KISSHORTCUTCONFIGURATION_H
bool operator==(const KisRegion &lhs, const KisRegion &rhs)
unsigned int uint
Abstract base class for input actions.
A class encapsulating all settings for a single shortcut.
@ MouseButtonType
A mouse button, possibly with key modifiers.
@ MouseWheelType
Mouse wheel movement, possibly with key modifiers.
@ KeyCombinationType
A list of keys that should be pressed.
@ UnknownType
Unknown, empty shortcut.
@ WheelDown
Downwards movement, toward the user.
@ WheelUp
Upwards movement, away from the user.
@ WheelReserved_0
Do not use! Previously was used for TouchpadScroll shortcut.
Q_DECLARE_METATYPE(KisShortcutConfiguration *)
QString buttons(const T &ev)