From b179480327bced1f5c5fd022a4768fa865b27686 Mon Sep 17 00:00:00 2001 From: vslg Date: Fri, 15 May 2020 20:23:20 -0300 Subject: [PATCH] Remove allowDragging, as it is not needed anymore --- src/gui/Base/HGridView.qml | 12 +----------- src/gui/Base/HListView.qml | 13 +------------ src/gui/Utils.qml | 6 +++--- 3 files changed, 5 insertions(+), 26 deletions(-) diff --git a/src/gui/Base/HGridView.qml b/src/gui/Base/HGridView.qml index 2bb2f5ad..4c97e66d 100644 --- a/src/gui/Base/HGridView.qml +++ b/src/gui/Base/HGridView.qml @@ -5,7 +5,6 @@ import QtQuick.Controls 2.12 GridView { id: gridView - interactive: allowDragging currentIndex: -1 keyNavigationWraps: true highlightMoveDuration: theme.animationDuration @@ -23,7 +22,7 @@ GridView { } ScrollBar.vertical: ScrollBar { - visible: gridView.interactive || ! gridView.allowDragging + visible: gridView.interactive } // property bool debug: false @@ -59,7 +58,6 @@ GridView { onSelectedCountChanged: if (! selectedCount) lastCheckedDelegateIndex = 0 - property bool allowDragging: true property alias cursorShape: mouseArea.cursorShape property int currentItemHeight: currentItem ? currentItem.height : 0 @@ -119,17 +117,9 @@ GridView { } - Connections { - target: gridView - enabled: ! gridView.allowDragging - // interactive gets temporarily set to true below to allow wheel scroll - onDraggingChanged: gridView.interactive = false - } - MouseArea { id: mouseArea anchors.fill: parent - enabled: ! parent.allowDragging || cursorShape !== Qt.ArrowCursor acceptedButtons: Qt.NoButton onWheel: { // Allow wheel usage, will be back to false on any drag attempt diff --git a/src/gui/Base/HListView.qml b/src/gui/Base/HListView.qml index 3725372c..6687b15a 100644 --- a/src/gui/Base/HListView.qml +++ b/src/gui/Base/HListView.qml @@ -5,8 +5,6 @@ import QtQuick.Controls 2.12 ListView { id: listView - //interactive: allowDragging - interactive: false currentIndex: -1 keyNavigationWraps: true highlightMoveDuration: theme.animationDuration @@ -25,7 +23,7 @@ ListView { } ScrollBar.vertical: ScrollBar { - visible: listView.interactive || ! listView.allowDragging + visible: listView.interactive } // property bool debug: false @@ -61,7 +59,6 @@ ListView { onSelectedCountChanged: if (! selectedCount) lastCheckedDelegateIndex = 0 - property bool allowDragging: true property alias cursorShape: mouseArea.cursorShape property int currentItemHeight: currentItem ? currentItem.height : 0 @@ -121,17 +118,9 @@ ListView { } - Connections { - target: listView - enabled: ! listView.allowDragging - // interactive gets temporarily set to true below to allow wheel scroll - onDraggingChanged: listView.interactive = false - } - HScrollMouseArea { id: mouseArea anchors.fill: parent - enabled: ! parent.allowDragging || cursorShape !== Qt.ArrowCursor acceptedButtons: Qt.NoButton flickable: listView } diff --git a/src/gui/Utils.qml b/src/gui/Utils.qml index 3add6868..ad7b550d 100644 --- a/src/gui/Utils.qml +++ b/src/gui/Utils.qml @@ -325,7 +325,7 @@ QtObject { function flickPages(flickable, pages) { // Adapt velocity and deceleration for the number of pages to flick. // If this is a repeated flicking, flick faster than a single flick. - if (! flickable.interactive && flickable.allowDragging) return + if (! flickable.interactive) return const futureVelocity = -flickable.height * pages const currentVelocity = -flickable.verticalVelocity @@ -351,7 +351,7 @@ QtObject { function flickToTop(flickable) { - if (! flickable.interactive && flickable.allowDragging) return + if (! flickable.interactive) return if (flickable.visibleArea.yPosition < 0) return flickable.contentY -= flickable.contentHeight @@ -361,7 +361,7 @@ QtObject { function flickToBottom(flickable) { - if (! flickable.interactive && flickable.allowDragging) return + if (! flickable.interactive) return if (flickable.visibleArea.yPosition < 0) return flickable.contentY = flickable.contentHeight - flickable.height