From d7b33b76a18b14e9f286e4d8326b00910b9ea02a Mon Sep 17 00:00:00 2001 From: Steffen Hartleib Date: Sun, 13 Sep 2020 18:53:32 +0000 Subject: Improve Touch support With this patch dolphin now supports the following touch gestures: * Tap gesture to interact/open with directories, files and so on * TapAndHold and release gesture for access to the context menu (main window, panel folder, places and information) * TapAndHold and moving gesture for drag and drop action (main windows, panel folder and places) * pinch gesture for zoom in main window * kinetic scrolling (QScroller) for main window, panel folder, panel places, panel information, setting preview and service * two fingers swipe gesture to left, right and up as shortcut to navigate back, forward and up * two finger tap gesture to toggle item selection, similar to Ctrl and left mouse click FEATURE: 385066 FIXED-IN: 20.11.80 You are currently rebasing branch 'touch' on '85241a924'. --- src/kitemviews/private/ktwofingerswipe.h | 54 ++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 src/kitemviews/private/ktwofingerswipe.h (limited to 'src/kitemviews/private/ktwofingerswipe.h') diff --git a/src/kitemviews/private/ktwofingerswipe.h b/src/kitemviews/private/ktwofingerswipe.h new file mode 100644 index 000000000..27d9d75d9 --- /dev/null +++ b/src/kitemviews/private/ktwofingerswipe.h @@ -0,0 +1,54 @@ +/* + * SPDX-FileCopyrightText: 2020 Steffen Hartleib + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#ifndef KTWOFINGERSWIPE_H +#define KTWOFINGERSWIPE_H + +#include "dolphin_export.h" +// Qt +#include +#include + +class DOLPHIN_EXPORT KTwoFingerSwipe : public QGesture +{ + Q_OBJECT + Q_PROPERTY(QPointF pos READ pos WRITE setPos) + Q_PROPERTY(QPointF screenPos READ screenPos WRITE setScreenPos) + Q_PROPERTY(QPointF scenePos READ scenePos WRITE setScenePos) + Q_PROPERTY(qreal swipeAngle READ swipeAngle WRITE setSwipeAngle) +public: + explicit KTwoFingerSwipe(QObject* parent = nullptr); + ~KTwoFingerSwipe(); + QPointF pos() const; + void setPos(QPointF pos); + QPointF screenPos() const; + void setScreenPos(QPointF screenPos); + QPointF scenePos() const; + void setScenePos(QPointF scenePos); + qreal swipeAngle() const; + void setSwipeAngle(qreal swipeAngle); +private: + QPointF m_pos; + QPointF m_screenPos; + QPointF m_scenePos; + qreal m_swipeAngle; +}; + +class DOLPHIN_EXPORT KTwoFingerSwipeRecognizer : public QGestureRecognizer +{ +public: + explicit KTwoFingerSwipeRecognizer(); + ~KTwoFingerSwipeRecognizer(); + QGesture* create(QObject*) override; + Result recognize(QGesture*, QObject*, QEvent*) override; +private: + Q_DISABLE_COPY( KTwoFingerSwipeRecognizer ) + qint64 m_touchBeginnTimestamp; + bool m_gestureAlreadyTriggered; +}; + +#endif /* KTWOFINGERSWIPE_H */ + -- cgit v1.3