Commit 8042ae81 authored by Artem Grinev's avatar Artem Grinev
Browse files

Use onEntered in KickoffItemDelegate

Using `onPositionChanged` instead of `onEntered` makes category change not so smooth (hard to notice sometimes though I got a number of such reports).

As `onPositionChanged` is used only to not to change category after scrolling end, this commit works around this problem and makes use of `onEntered`.
parent 8cad9c45
Pipeline #178002 passed with stage
in 4 minutes and 55 seconds
......@@ -203,9 +203,15 @@ T.ItemDelegate {
// Using this Item fixes drag and drop causing delegates
// to reset to a 0 X position and overlapping each other.
Item { id: dragItem }
// Using onPositionChanged instead of onEntered to prevent changing
// categories while scrolling with the mouse wheel.
onPositionChanged: {
// Using onPositionChanged adds subtle freeze when
// changing category. To address scrolling problem
// we'll rely on check if view was scrolled with wheel.
onEntered: {
if(root.view.movedWithWheel) {
root.view.movedWithWheel = false
return
}
// forceActiveFocus() touches multiple items, so check for
// activeFocus first to be more efficient.
if (!root.activeFocus) {
......
......@@ -71,6 +71,7 @@ EmptyPage {
readonly property real availableWidth: width - leftMargin - rightMargin
readonly property real availableHeight: height - topMargin - bottomMargin
property bool movedWithKeyboard: false
property bool movedWithWheel: false
Accessible.role: Accessible.List
......@@ -181,6 +182,10 @@ EmptyPage {
// because Plasma doesn't support Qt scaling.
horizontalStepSize: 20 * Qt.styleHints.wheelScrollLines * PlasmaCore.Units.devicePixelRatio
verticalStepSize: 20 * Qt.styleHints.wheelScrollLines * PlasmaCore.Units.devicePixelRatio
onWheel: {
view.movedWithWheel = true
}
}
Connections {
......@@ -198,6 +203,12 @@ EmptyPage {
interval: 200
onTriggered: view.movedWithKeyboard = false
}
Timer {
id: movedWithWheelTimer
interval: 200
onTriggered: view.movedWithWheel = false
}
function focusCurrentItem(event, focusReason) {
currentItem.forceActiveFocus(focusReason)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment