From a6c193db1339e0121286ae584596673fdd94058f Mon Sep 17 00:00:00 2001 From: deepin-ci-robot Date: Tue, 2 Sep 2025 12:06:46 +0000 Subject: [PATCH] sync: from linuxdeepin/dtkdeclarative Synchronize source files from linuxdeepin/dtkdeclarative. Source-pull-request: https://github.com/linuxdeepin/dtkdeclarative/pull/524 --- qt6/src/qml/ArrowListView.qml | 4 +- qt6/src/qml/private/ArrowListViewButton.qml | 41 +++++++++++++++++++-- 2 files changed, 39 insertions(+), 6 deletions(-) diff --git a/qt6/src/qml/ArrowListView.qml b/qt6/src/qml/ArrowListView.qml index 2385f2a9..625ab7de 100644 --- a/qt6/src/qml/ArrowListView.qml +++ b/qt6/src/qml/ArrowListView.qml @@ -24,7 +24,7 @@ FocusScope { P.ArrowListViewButton { visible: itemsView.interactive Layout.alignment: Qt.AlignHCenter - Layout.preferredWidth: width + Layout.fillWidth: true Layout.preferredHeight: height view: itemsView direction: P.ArrowListViewButton.UpButton @@ -79,7 +79,7 @@ FocusScope { P.ArrowListViewButton { visible: itemsView.interactive Layout.alignment: Qt.AlignHCenter - Layout.preferredWidth: width + Layout.fillWidth: true Layout.preferredHeight: height view: itemsView direction: P.ArrowListViewButton.DownButton diff --git a/qt6/src/qml/private/ArrowListViewButton.qml b/qt6/src/qml/private/ArrowListViewButton.qml index bae1a437..863bbec1 100644 --- a/qt6/src/qml/private/ArrowListViewButton.qml +++ b/qt6/src/qml/private/ArrowListViewButton.qml @@ -16,8 +16,8 @@ Loader { property int direction active: view.interactive - sourceComponent: Button { - flat: true + sourceComponent: ActionButton { + palette.windowText: undefined enabled: direction === ArrowListViewButton.UpButton ? !view.atYBeginning : !view.atYEnd width: DS.Style.arrowListView.stepButtonSize.width height: DS.Style.arrowListView.stepButtonSize.height @@ -25,7 +25,40 @@ Loader { : DS.Style.arrowListView.downButtonIconName icon.width: DS.Style.arrowListView.stepButtonIconSize.width icon.height: DS.Style.arrowListView.stepButtonIconSize.height - onClicked: direction === ArrowListViewButton.UpButton ? view.decrementCurrentIndex() - : view.incrementCurrentIndex() + + // Unified scroll operation function + function performScroll() { + direction === ArrowListViewButton.UpButton ? view.decrementCurrentIndex() + : view.incrementCurrentIndex() + } + + // Auto-scroll control properties using state machine approach + property bool shouldAutoScroll: hovered && enabled + property bool delayCompleted: false + + // Timer for initial delay before starting hover scroll + Timer { + id: initialDelayTimer + interval: 300 + repeat: false + running: shouldAutoScroll && !delayCompleted + onTriggered: delayCompleted = true + } + + // Timer for continuous hover scrolling + Timer { + id: hoverScrollTimer + interval: 100 + repeat: true + running: shouldAutoScroll && delayCompleted + onTriggered: performScroll() + } + + // Reset state when auto-scroll should stop + onShouldAutoScrollChanged: { + if (!shouldAutoScroll) { + delayCompleted = false + } + } } }