┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/kitemviews/kitemlistcontroller.h
diff options
context:
space:
mode:
authorSteffen Hartleib <[email protected]>2020-09-13 18:53:32 +0000
committerElvis Angelaccio <[email protected]>2020-09-13 18:53:32 +0000
commitd7b33b76a18b14e9f286e4d8326b00910b9ea02a (patch)
treeade5042c74a0d172172a9327244858825076c333 /src/kitemviews/kitemlistcontroller.h
parentd899c2b401869d29558f62fba3479bf744b0577c (diff)
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'.
Diffstat (limited to 'src/kitemviews/kitemlistcontroller.h')
-rw-r--r--src/kitemviews/kitemlistcontroller.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/kitemviews/kitemlistcontroller.h b/src/kitemviews/kitemlistcontroller.h
index a84d1b8c8..d929027b7 100644
--- a/src/kitemviews/kitemlistcontroller.h
+++ b/src/kitemviews/kitemlistcontroller.h
@@ -14,6 +14,7 @@
#include <QObject>
#include <QPointF>
+#include <QScroller>
class QTimer;
class KItemModelBase;
@@ -21,6 +22,7 @@ class KItemListKeyboardSearchManager;
class KItemListSelectionManager;
class KItemListView;
class KItemListWidget;
+class QGestureEvent;
class QGraphicsSceneHoverEvent;
class QGraphicsSceneDragDropEvent;
class QGraphicsSceneMouseEvent;
@@ -28,6 +30,7 @@ class QGraphicsSceneResizeEvent;
class QGraphicsSceneWheelEvent;
class QInputMethodEvent;
class QKeyEvent;
+class QTapGesture;
class QTransform;
/**
@@ -208,6 +211,14 @@ signals:
void selectedItemTextPressed(int index);
+ void scrollerStop();
+ void increaseZoom();
+ void decreaseZoom();
+ void swipeUp();
+
+public slots:
+ void slotStateChanged(QScroller::State newState);
+
private slots:
void slotViewScrollOffsetChanged(qreal current, qreal previous);
@@ -289,11 +300,25 @@ private:
bool hoverLeaveEvent(QGraphicsSceneHoverEvent* event, const QTransform& transform);
bool wheelEvent(QGraphicsSceneWheelEvent* event, const QTransform& transform);
bool resizeEvent(QGraphicsSceneResizeEvent* event, const QTransform& transform);
+ bool gestureEvent(QGestureEvent* event, const QTransform& transform);
+ void tapTriggered(QTapGesture* tap, const QTransform& transform);
+ void tapAndHoldTriggered(QGestureEvent* event, const QTransform& transform);
+ void pinchTriggered(QGestureEvent* event, const QTransform& transform);
+ void swipeTriggered(QGestureEvent* event, const QTransform& transform);
+ void twoFingerTapTriggered(QGestureEvent* event, const QTransform& transform);
+ bool onPress(const QPoint& screenPos, const QPointF& pos, const Qt::KeyboardModifiers modifiers, const Qt::MouseButtons buttons);
+ bool onRelease(const QPointF& pos, const Qt::KeyboardModifiers modifiers, const Qt::MouseButtons buttons, bool touch);
+ void startRubberBand();
private:
bool m_singleClickActivationEnforced;
bool m_selectionTogglePressed;
bool m_clearSelectionIfItemsAreNotDragged;
+ bool m_isSwipeGesture;
+ bool m_dragActionOrRightClick;
+ bool m_scrollerIsScrolling;
+ bool m_pinchGestureInProgress;
+ bool m_mousePress;
SelectionBehavior m_selectionBehavior;
AutoActivationBehavior m_autoActivationBehavior;
MouseDoubleClickAction m_mouseDoubleClickAction;
@@ -306,6 +331,10 @@ private:
QTimer* m_autoActivationTimer;
+ Qt::GestureType m_swipeGesture;
+ Qt::GestureType m_twoFingerTapGesture;
+ Qt::MouseEventSource m_lastSource;
+
/**
* When starting a rubberband selection during a Shift- or Control-key has been
* pressed the current selection should never be deleted. To be able to restore