Skip to content

Commit 178c75c

Browse files
deepin-ci-robot18202781743
authored andcommitted
sync: from linuxdeepin/dtkdeclarative
Synchronize source files from linuxdeepin/dtkdeclarative. Source-pull-request: linuxdeepin/dtkdeclarative#524
1 parent 8ff4e07 commit 178c75c

2 files changed

Lines changed: 39 additions & 6 deletions

File tree

qt6/src/qml/ArrowListView.qml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ FocusScope {
2424
P.ArrowListViewButton {
2525
visible: itemsView.interactive
2626
Layout.alignment: Qt.AlignHCenter
27-
Layout.preferredWidth: width
27+
Layout.fillWidth: true
2828
Layout.preferredHeight: height
2929
view: itemsView
3030
direction: P.ArrowListViewButton.UpButton
@@ -79,7 +79,7 @@ FocusScope {
7979
P.ArrowListViewButton {
8080
visible: itemsView.interactive
8181
Layout.alignment: Qt.AlignHCenter
82-
Layout.preferredWidth: width
82+
Layout.fillWidth: true
8383
Layout.preferredHeight: height
8484
view: itemsView
8585
direction: P.ArrowListViewButton.DownButton

qt6/src/qml/private/ArrowListViewButton.qml

Lines changed: 37 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,49 @@ Loader {
1616
property int direction
1717
active: view.interactive
1818

19-
sourceComponent: Button {
20-
flat: true
19+
sourceComponent: ActionButton {
20+
palette.windowText: undefined
2121
enabled: direction === ArrowListViewButton.UpButton ? !view.atYBeginning : !view.atYEnd
2222
width: DS.Style.arrowListView.stepButtonSize.width
2323
height: DS.Style.arrowListView.stepButtonSize.height
2424
icon.name: direction === ArrowListViewButton.UpButton ? DS.Style.arrowListView.upButtonIconName
2525
: DS.Style.arrowListView.downButtonIconName
2626
icon.width: DS.Style.arrowListView.stepButtonIconSize.width
2727
icon.height: DS.Style.arrowListView.stepButtonIconSize.height
28-
onClicked: direction === ArrowListViewButton.UpButton ? view.decrementCurrentIndex()
29-
: view.incrementCurrentIndex()
28+
29+
// Unified scroll operation function
30+
function performScroll() {
31+
direction === ArrowListViewButton.UpButton ? view.decrementCurrentIndex()
32+
: view.incrementCurrentIndex()
33+
}
34+
35+
// Auto-scroll control properties using state machine approach
36+
property bool shouldAutoScroll: hovered && enabled
37+
property bool delayCompleted: false
38+
39+
// Timer for initial delay before starting hover scroll
40+
Timer {
41+
id: initialDelayTimer
42+
interval: 300
43+
repeat: false
44+
running: shouldAutoScroll && !delayCompleted
45+
onTriggered: delayCompleted = true
46+
}
47+
48+
// Timer for continuous hover scrolling
49+
Timer {
50+
id: hoverScrollTimer
51+
interval: 100
52+
repeat: true
53+
running: shouldAutoScroll && delayCompleted
54+
onTriggered: performScroll()
55+
}
56+
57+
// Reset state when auto-scroll should stop
58+
onShouldAutoScrollChanged: {
59+
if (!shouldAutoScroll) {
60+
delayCompleted = false
61+
}
62+
}
3063
}
3164
}

0 commit comments

Comments
 (0)