From 474ddd078d0d976a84e88b8003bbf0cee40a2aaa Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Tue, 17 Nov 2026 09:40:51 +0100 Subject: feat(settings): faster wheel scrolling, and paging keys on pages The settings window's page scroller, sidebar and landing page take a higher maximum flick velocity (8000, Qt's default 2500) and a stronger deceleration (4000, from 1500), so a fast wheel spin travels further while a single notch does not coast on. Pages also answer Page Up/Down (90% of a screen) and Home/End. A ScrollView handles none of them, and nothing on a page could hold focus except its fields, so a MouseArea beneath the content focuses the scroller on a click in empty space. It sits under every item, so fields and buttons keep their clicks; it has no onWheel, so wheel events pass to the Flickable. Keys pressed in a field bubble up: Page Up/Down still scroll, Home/End stay with the field's cursor. Co-Authored-By: Claude Opus 5.5 --- desktop/Page.qml | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'desktop/Page.qml') diff --git a/desktop/Page.qml b/desktop/Page.qml index eb1c5c0..02b2da8 100644 --- a/desktop/Page.qml +++ b/desktop/Page.qml @@ -138,6 +138,27 @@ Item { anchors.topMargin: 12 clip: true contentWidth: availableWidth + // Faster wheel scrolling than Qt's defaults (2500, 1500); the + // sidebar and the landing page in Settings.qml use the same pair. + Component.onCompleted: { + scroll.contentItem.maximumFlickVelocity = 8000; + scroll.contentItem.flickDeceleration = 4000; + } + + // Page Up/Down, Home/End scroll the page. Reached when the page + // itself has focus (a click on empty space, below) or bubbling up + // from a field, which keeps Home/End for its cursor. + Keys.onPressed: e => { + const f = scroll.contentItem, max = Math.max(0, f.contentHeight - f.height); + const to = e.key === Qt.Key_PageUp ? f.contentY - f.height * 0.9 + : e.key === Qt.Key_PageDown ? f.contentY + f.height * 0.9 + : e.key === Qt.Key_Home ? 0 + : e.key === Qt.Key_End ? max : null; + if (to === null) return; + f.cancelFlick(); + f.contentY = Math.max(0, Math.min(to, max)); + e.accepted = true; + } Item { id: holder @@ -146,6 +167,16 @@ Item { } } + // A click on empty page space focuses the page, for the keys above. + // Beneath the content, so fields and buttons keep their clicks; it takes + // no wheel (no onWheel) and the Flickable still steals drags from it. + MouseArea { + parent: holder + z: -1 + anchors.fill: parent + onPressed: scroll.forceActiveFocus() + } + // The reveal highlight, over the row and in holder's coordinates. // Declared out here, not in the ScrollView, which sizes from a single // child; parent puts it in holder all the same. -- cgit v1.2.3