File indexing completed on 2024-12-22 04:12:44
0001 /* 0002 * SPDX-FileCopyrightText: 2012 Dmitry Kazakov <dimula73@gmail.com> 0003 * 0004 * SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #ifndef __KIS_SINGLE_ACTION_SHORTCUT_H 0008 #define __KIS_SINGLE_ACTION_SHORTCUT_H 0009 0010 #include "kis_abstract_shortcut.h" 0011 0012 /** 0013 * This class represents a shortcut that executes a simple atomic 0014 * action. It can be initiated either by a keyboard hotkey or by 0015 * a mouse wheel rotation. 0016 */ 0017 0018 class KRITAUI_EXPORT KisSingleActionShortcut : public KisAbstractShortcut 0019 { 0020 public: 0021 enum WheelAction { 0022 WheelUp, ///< Mouse wheel moves up. 0023 WheelDown, ///< Mouse wheel moves down. 0024 WheelLeft, ///< Mouse wheel moves left. 0025 WheelRight, ///< Mouse wheel moves right. 0026 WheelTrackpad, ///< A pan movement on a trackpad. 0027 }; 0028 0029 KisSingleActionShortcut(KisAbstractInputAction *action, int index); 0030 ~KisSingleActionShortcut() override; 0031 0032 int priority() const override; 0033 0034 void setKey(const QSet<Qt::Key> &modifiers, Qt::Key key); 0035 void setWheel(const QSet<Qt::Key> &modifiers, WheelAction wheelAction); 0036 0037 bool match(const QSet<Qt::Key> &modifiers, Qt::Key key); 0038 bool match(const QSet<Qt::Key> &modifiers, WheelAction wheelAction); 0039 0040 /** 0041 * Check is the shortcut or the key sequnce is a prefix of one another 0042 */ 0043 bool conflictsWith(const QKeySequence &seq); 0044 0045 private: 0046 class Private; 0047 Private * const m_d; 0048 }; 0049 0050 #endif /* __KIS_SINGLE_ACTION_SHORTCUT_H */