homescreens: Use WheelHandler on app list

Use Kirigami.WheelHandler on the app list to give a native feeling
scrolling experience with the mouse wheel.
This commit is contained in:
Devin Lin 2024-10-29 22:29:31 -07:00
parent 35b1128d1d
commit 11a45f94d2
2 changed files with 19 additions and 1 deletions

View file

@ -46,6 +46,15 @@ MobileShell.GridView {
interactive: (dragging || !atYBeginning) // allow us to drag to the top
&& folio.HomeScreenState.swipeState !== Folio.HomeScreenState.SwipingAppDrawerGrid
// Handle mouse wheel scrolling
Kirigami.WheelHandler {
target: root
filterMouseEvents: false
// `20 * Qt.styleHints.wheelScrollLines` is the default speed.
horizontalStepSize: 20 * Qt.styleHints.wheelScrollLines
verticalStepSize: 20 * Qt.styleHints.wheelScrollLines
}
Connections {
target: folio.HomeScreenState

View file

@ -8,7 +8,7 @@ import QtQuick.Layouts 1.1
import QtQuick.Controls 2.15 as Controls
import org.kde.plasma.components 3.0 as PC3
import org.kde.kirigami 2.10 as Kirigami
import org.kde.kirigami as Kirigami
import org.kde.plasma.private.mobileshell as MobileShell
import org.kde.plasma.private.mobileshell.state as MobileShellState
@ -69,6 +69,15 @@ MobileShell.GridView {
}
}
// Handle mouse wheel scrolling
Kirigami.WheelHandler {
target: gridView
filterMouseEvents: false
// `20 * Qt.styleHints.wheelScrollLines` is the default speed.
horizontalStepSize: 20 * Qt.styleHints.wheelScrollLines
verticalStepSize: 20 * Qt.styleHints.wheelScrollLines
}
PC3.Label {
id: metrics
text: "M\nM"