aboutsummaryrefslogtreecommitdiffstats
path: root/desktop/Page.qml
diff options
context:
space:
mode:
Diffstat (limited to 'desktop/Page.qml')
-rw-r--r--desktop/Page.qml31
1 files changed, 31 insertions, 0 deletions
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.