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/kitemlistcontainer.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'src/kitemviews/kitemlistcontainer.cpp') diff --git a/src/kitemviews/kitemlistcontainer.cpp b/src/kitemviews/kitemlistcontainer.cpp index dfd5e8a04..77847bcc7 100644 --- a/src/kitemviews/kitemlistcontainer.cpp +++ b/src/kitemviews/kitemlistcontainer.cpp @@ -17,6 +17,7 @@ #include #include #include +#include #include /** @@ -54,7 +55,8 @@ KItemListContainer::KItemListContainer(KItemListController* controller, QWidget* QAbstractScrollArea(parent), m_controller(controller), m_horizontalSmoothScroller(nullptr), - m_verticalSmoothScroller(nullptr) + m_verticalSmoothScroller(nullptr), + m_scroller(nullptr) { Q_ASSERT(controller); controller->setParent(this); @@ -76,6 +78,13 @@ KItemListContainer::KItemListContainer(KItemListController* controller, QWidget* this, &KItemListContainer::slotModelChanged); connect(controller, &KItemListController::viewChanged, this, &KItemListContainer::slotViewChanged); + + m_scroller = QScroller::scroller(viewport()); + m_scroller->grabGesture(viewport()); + connect(controller, &KItemListController::scrollerStop, + this, &KItemListContainer::stopScroller); + connect(m_scroller, &QScroller::stateChanged, + controller, &KItemListController::slotStateChanged); } KItemListContainer::~KItemListContainer() @@ -325,6 +334,11 @@ void KItemListContainer::updateItemOffsetScrollBar() } } +void KItemListContainer::stopScroller() +{ + m_scroller->stop(); +} + void KItemListContainer::updateGeometries() { QRect rect = geometry(); -- cgit v1.3