Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions qt6/src/qml/ArrowListView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ FocusScope {
Layout.fillWidth: true
Layout.preferredHeight: height
view: itemsView
stepSize: control.itemHeight
direction: P.ArrowListViewButton.UpButton
}

Expand Down Expand Up @@ -82,6 +83,7 @@ FocusScope {
Layout.fillWidth: true
Layout.preferredHeight: height
view: itemsView
stepSize: control.itemHeight
direction: P.ArrowListViewButton.DownButton
}
}
Expand Down
24 changes: 14 additions & 10 deletions qt6/src/qml/private/ArrowListViewButton.qml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Loader {

required property Item view
property int direction
property int stepSize: DS.Style.arrowListView.itemHeight
active: view.interactive

sourceComponent: ActionButton {
Expand All @@ -26,17 +27,21 @@ Loader {
icon.width: DS.Style.arrowListView.stepButtonIconSize.width
icon.height: DS.Style.arrowListView.stepButtonIconSize.height

// Unified scroll operation function
function performScroll() {
direction === ArrowListViewButton.UpButton ? view.decrementCurrentIndex()
: view.incrementCurrentIndex()
if (!view)
return
var maxY = Math.max(0, view.contentHeight - view.height)
if (maxY <= 0)
return
var step = Math.max(1, stepSize)
var nextY = direction === ArrowListViewButton.UpButton ? (view.contentY - step)
: (view.contentY + step)
view.contentY = Math.max(0, Math.min(maxY, nextY))
}

// 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
Expand All @@ -45,20 +50,19 @@ Loader {
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) {
if (!shouldAutoScroll)
delayCompleted = false
}
}

onClicked: performScroll()
}
}
Loading