File indexing completed on 2024-05-19 04:21:34
0001 /* 0002 Gwenview: an image viewer 0003 Copyright 2019 Steffen Hartleib <steffenhartleib@t-online.de> 0004 0005 This program is free software; you can redistribute it and/or 0006 modify it under the terms of the GNU General Public License 0007 as published by the Free Software Foundation; either version 2 0008 of the License, or (at your option) any later version. 0009 0010 This program is distributed in the hope that it will be useful, 0011 but WITHOUT ANY WARRANTY; without even the implied warranty of 0012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0013 GNU General Public License for more details. 0014 0015 You should have received a copy of the GNU General Public License 0016 along with this program; if not, write to the Free Software 0017 Foundation, Inc., 51 Franklin Street, Fifth Floor, Cambridge, MA 02110-1301, USA. 0018 0019 */ 0020 #ifndef TWOFINGERPAN_H 0021 #define TWOFINGERPAN_H 0022 0023 #include <lib/gwenviewlib_export.h> 0024 0025 // Qt 0026 #include <QGesture> 0027 #include <QGestureRecognizer> 0028 0029 // KF 0030 0031 // Local 0032 0033 namespace Gwenview 0034 { 0035 struct TwoFingerPanRecognizerPrivate; 0036 0037 class GWENVIEWLIB_EXPORT TwoFingerPan : public QGesture 0038 { 0039 Q_PROPERTY(QPointF delta READ getDelta WRITE setDelta) 0040 Q_PROPERTY(bool delayActive READ getDelayActive WRITE setDelayActive) 0041 0042 public: 0043 explicit TwoFingerPan(QObject *parent = nullptr); 0044 QPointF getDelta() 0045 { 0046 return delta; 0047 }; 0048 void setDelta(QPointF _delta) 0049 { 0050 delta = _delta; 0051 }; 0052 bool getDelayActive() 0053 { 0054 return delayActive; 0055 }; 0056 void setDelayActive(bool _delay) 0057 { 0058 delayActive = _delay; 0059 }; 0060 0061 private: 0062 QPointF delta; 0063 bool delayActive; 0064 }; 0065 0066 class GWENVIEWLIB_EXPORT TwoFingerPanRecognizer : public QGestureRecognizer 0067 { 0068 public: 0069 explicit TwoFingerPanRecognizer(); 0070 ~TwoFingerPanRecognizer() override; 0071 0072 private: 0073 TwoFingerPanRecognizerPrivate *d; 0074 0075 virtual QGesture *create(QObject *) override; 0076 virtual Result recognize(QGesture *, QObject *, QEvent *) override; 0077 }; 0078 0079 } // namespace 0080 #endif /* TWOFINGERPAN_H */