File indexing completed on 2024-12-22 04:12:42

0001 /*
0002  *  SPDX-FileCopyrightText: 2017 Bernhard Liebl <poke1024@gmx.de>
0003  *
0004  *  SPDX-License-Identifier: GPL-2.0-or-later
0005  *
0006  */
0007 
0008 #include "kis_native_gesture_shortcut.h"
0009 
0010 #include <QNativeGestureEvent>
0011 
0012 class KisNativeGestureShortcut::Private
0013 {
0014 public:
0015     Private() { }
0016 
0017     // Coverity requires sane defaults for every variable (CID 248365)
0018     Qt::NativeGestureType type {Qt::PanNativeGesture};
0019 };
0020 
0021 KisNativeGestureShortcut::KisNativeGestureShortcut(KisAbstractInputAction* action, int index, Qt::NativeGestureType type)
0022     : KisAbstractShortcut(action, index), d(new Private)
0023 {
0024     d->type = type;
0025 }
0026 
0027 KisNativeGestureShortcut::~KisNativeGestureShortcut()
0028 {
0029     delete d;
0030 }
0031 
0032 int KisNativeGestureShortcut::priority() const
0033 {
0034     return 0;
0035 }
0036 
0037 bool KisNativeGestureShortcut::match(QNativeGestureEvent* event)
0038 {
0039     //printf("checking NativeGesture against KisNativeGestureShortcut %d %d\n", (int)event->gestureType(), (int)d->type);
0040     return event->gestureType() == d->type;
0041 }