]> cloud.milkyroute.net Git - dolphin.git/blob - src/kitemviews/private/ktwofingertap.h
Fix tooltip closing while mouse moves over item
[dolphin.git] / src / kitemviews / private / ktwofingertap.h
1 /*
2 * SPDX-FileCopyrightText: 2020 Steffen Hartleib <steffenhartleib@t-online.de>
3 *
4 * SPDX-License-Identifier: GPL-2.0-or-later
5 */
6
7 #ifndef KTWOFINGERTAP_H
8 #define KTWOFINGERTAP_H
9
10 #include <dolphin_export.h>
11 // Qt
12 #include <QGesture>
13 #include <QGestureRecognizer>
14
15 class DOLPHIN_EXPORT KTwoFingerTap : public QGesture
16 {
17 Q_OBJECT
18 Q_PROPERTY(QPointF pos READ pos WRITE setPos)
19 Q_PROPERTY(QPointF screenPos READ screenPos WRITE setScreenPos)
20 Q_PROPERTY(QPointF scenePos READ scenePos WRITE setScenePos)
21 public:
22 explicit KTwoFingerTap(QObject* parent = nullptr);
23 ~KTwoFingerTap() override;
24 QPointF pos() const;
25 void setPos(QPointF pos);
26 QPointF screenPos() const;
27 void setScreenPos(QPointF screenPos);
28 QPointF scenePos() const;
29 void setScenePos(QPointF scenePos);
30 private:
31 QPointF m_pos;
32 QPointF m_screenPos;
33 QPointF m_scenePos;
34 };
35
36 class DOLPHIN_EXPORT KTwoFingerTapRecognizer : public QGestureRecognizer
37 {
38 public:
39 explicit KTwoFingerTapRecognizer();
40 ~KTwoFingerTapRecognizer() override;
41 QGesture* create(QObject*) override;
42 Result recognize(QGesture*, QObject*, QEvent*) override;
43 private:
44 Q_DISABLE_COPY(KTwoFingerTapRecognizer)
45 bool m_gestureTriggered;
46 };
47
48 #endif /* KTWOFINGERTAP_H */