kf5: replace sloppy focus with click-to-focus

The hover-based sloppy focus timer was stealing focus from buttons
via paneRoot.focus=true every 100ms of mouse movement, making
buttons very hard to click.

Replace with a click-to-focus MouseArea that only updates the
focusedPaneIndex on actual clicks, with mouse.accepted=false
so clicks propagate to the target widget normally.
This commit is contained in:
Levi Neely 2026-07-27 15:28:40 +02:00
parent d6c3e82dc8
commit 582ea51126
1 changed files with 4 additions and 12 deletions

View File

@ -1385,21 +1385,13 @@ ApplicationWindow {
}
}
// Sloppy focus
// Click-to-focus: update focused pane index on click
MouseArea {
anchors.fill: parent
hoverEnabled: true
acceptedButtons: Qt.NoButton
acceptedButtons: Qt.LeftButton
propagateComposedEvents: true
onPositionChanged: sloppyTimer.restart()
onExited: sloppyTimer.stop()
}
Timer {
id: sloppyTimer
interval: 100
onTriggered: {
paneRoot.focus = true
// Update focused index
onPressed: {
mouse.accepted = false
for (var i = 0; i < mainContent.panes.length; i++) {
if (mainContent.panes[i] === paneRoot) {
mainContent.focusedPaneIndex = i