Remove allowDragging, as it is not needed anymore

This commit is contained in:
vslg 2020-05-15 20:23:20 -03:00
parent d840080fdb
commit b179480327
3 changed files with 5 additions and 26 deletions

View File

@ -5,7 +5,6 @@ import QtQuick.Controls 2.12
GridView { GridView {
id: gridView id: gridView
interactive: allowDragging
currentIndex: -1 currentIndex: -1
keyNavigationWraps: true keyNavigationWraps: true
highlightMoveDuration: theme.animationDuration highlightMoveDuration: theme.animationDuration
@ -23,7 +22,7 @@ GridView {
} }
ScrollBar.vertical: ScrollBar { ScrollBar.vertical: ScrollBar {
visible: gridView.interactive || ! gridView.allowDragging visible: gridView.interactive
} }
// property bool debug: false // property bool debug: false
@ -59,7 +58,6 @@ GridView {
onSelectedCountChanged: if (! selectedCount) lastCheckedDelegateIndex = 0 onSelectedCountChanged: if (! selectedCount) lastCheckedDelegateIndex = 0
property bool allowDragging: true
property alias cursorShape: mouseArea.cursorShape property alias cursorShape: mouseArea.cursorShape
property int currentItemHeight: currentItem ? currentItem.height : 0 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 { MouseArea {
id: mouseArea id: mouseArea
anchors.fill: parent anchors.fill: parent
enabled: ! parent.allowDragging || cursorShape !== Qt.ArrowCursor
acceptedButtons: Qt.NoButton acceptedButtons: Qt.NoButton
onWheel: { onWheel: {
// Allow wheel usage, will be back to false on any drag attempt // Allow wheel usage, will be back to false on any drag attempt

View File

@ -5,8 +5,6 @@ import QtQuick.Controls 2.12
ListView { ListView {
id: listView id: listView
//interactive: allowDragging
interactive: false
currentIndex: -1 currentIndex: -1
keyNavigationWraps: true keyNavigationWraps: true
highlightMoveDuration: theme.animationDuration highlightMoveDuration: theme.animationDuration
@ -25,7 +23,7 @@ ListView {
} }
ScrollBar.vertical: ScrollBar { ScrollBar.vertical: ScrollBar {
visible: listView.interactive || ! listView.allowDragging visible: listView.interactive
} }
// property bool debug: false // property bool debug: false
@ -61,7 +59,6 @@ ListView {
onSelectedCountChanged: if (! selectedCount) lastCheckedDelegateIndex = 0 onSelectedCountChanged: if (! selectedCount) lastCheckedDelegateIndex = 0
property bool allowDragging: true
property alias cursorShape: mouseArea.cursorShape property alias cursorShape: mouseArea.cursorShape
property int currentItemHeight: currentItem ? currentItem.height : 0 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 { HScrollMouseArea {
id: mouseArea id: mouseArea
anchors.fill: parent anchors.fill: parent
enabled: ! parent.allowDragging || cursorShape !== Qt.ArrowCursor
acceptedButtons: Qt.NoButton acceptedButtons: Qt.NoButton
flickable: listView flickable: listView
} }

View File

@ -325,7 +325,7 @@ QtObject {
function flickPages(flickable, pages) { function flickPages(flickable, pages) {
// Adapt velocity and deceleration for the number of pages to flick. // Adapt velocity and deceleration for the number of pages to flick.
// If this is a repeated flicking, flick faster than a single 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 futureVelocity = -flickable.height * pages
const currentVelocity = -flickable.verticalVelocity const currentVelocity = -flickable.verticalVelocity
@ -351,7 +351,7 @@ QtObject {
function flickToTop(flickable) { function flickToTop(flickable) {
if (! flickable.interactive && flickable.allowDragging) return if (! flickable.interactive) return
if (flickable.visibleArea.yPosition < 0) return if (flickable.visibleArea.yPosition < 0) return
flickable.contentY -= flickable.contentHeight flickable.contentY -= flickable.contentHeight
@ -361,7 +361,7 @@ QtObject {
function flickToBottom(flickable) { function flickToBottom(flickable) {
if (! flickable.interactive && flickable.allowDragging) return if (! flickable.interactive) return
if (flickable.visibleArea.yPosition < 0) return if (flickable.visibleArea.yPosition < 0) return
flickable.contentY = flickable.contentHeight - flickable.height flickable.contentY = flickable.contentHeight - flickable.height