Krita Source Code Documentation
Loading...
Searching...
No Matches
kis_touch_shortcut.cpp
Go to the documentation of this file.
1/*
2 * This file is part of the KDE project
3 * SPDX-FileCopyrightText: 2012 Arjen Hiemstra <ahiemstra@heimr.nl>
4 *
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 *
7 */
8
11#include "kis_config.h"
12
13#include <QTouchEvent>
14
30
32 : KisAbstractShortcut(action, index)
33 , d(new Private(type))
34{
35
36}
37
42
44{
45 return action()->priority();
46}
47
49{
50#ifdef Q_OS_MACOS
51 return false; // No equivalent gestures on macOS.
52#else
54#endif
55}
56
61
66
67void KisTouchShortcut::setDisableOnTouchPainting(bool disableOnTouchPainting)
68{
69 d->disableOnTouchPainting = disableOnTouchPainting;
70}
71
72bool KisTouchShortcut::matchTapType(QTouchEvent *event)
73{
74 return matchTouchPoint(event)
75#ifndef Q_OS_MACOS
77#endif
78 ;
79}
80
81bool KisTouchShortcut::matchDragType(QTouchEvent *event)
82{
83 return matchTouchPoint(event)
84#ifndef Q_OS_MACOS
86#endif
87 ;
88}
89
90bool KisTouchShortcut::matchHoldType(QTouchEvent *event)
91{
92 return isHoldType() && matchTouchPoint(event);
93}
94
95bool KisTouchShortcut::matchTouchPoint(QTouchEvent *event)
96{
97 return (!d->disableOnTouchPainting || KisConfig(true).disableTouchOnCanvas())
98 && event->touchPoints().count() >= d->minTouchPoints && event->touchPoints().count() <= d->maxTouchPoints;
99}
Abstract base class for input actions.
KisAbstractInputAction * action
bool matchDragType(QTouchEvent *event)
bool matchTapType(QTouchEvent *event)
KisTouchShortcut(KisAbstractInputAction *action, int index, GestureAction type)
bool matchHoldType(QTouchEvent *event)
bool matchTouchPoint(QTouchEvent *event)
void setMaximumTouchPoints(int max)
void setDisableOnTouchPainting(bool disableOnTouchPainting)
int priority() const override
void setMinimumTouchPoints(int min)