Bug 459004

Summary: QQC2 spinbox buttons show as hovered when spinbox is hovered
Product: [Frameworks and Libraries] frameworks-qqc2-desktop-style Reporter: Oliver Beard <olib141>
Component: generalAssignee: ratijas <me>
Status: RESOLVED FIXED    
Severity: minor CC: ahiemstra, kde, me, noahadvs, notmart, uhhadd
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: Image showing the bug
QQC2 kde desktop style SpinBox hover glitch

Description Oliver Beard 2022-09-11 17:01:43 UTC
Created attachment 151989 [details]
Image showing the bug

SUMMARY
The last hovered spinbox button will appear as hovered over, turning blue, when hovering over the spinbox itself, and not the buttons.


STEPS TO REPRODUCE
1. Open, for example, the Notifications kcm
2. Hover over a spinbox button
3. Hover over the spinbox, but not any of the internal buttons

OBSERVED RESULT
The button appears as hovered over, when it isn't.

EXPECTED RESULT
The button shouldn't. When you haven't hovered over any buttons yet, the spinbox appears normal.

SOFTWARE/OS VERSIONS
KDE Plasma Version: 5.25.5
KDE Frameworks Version: 5.97.0
Qt Version: 5.15.6

ADDITIONAL INFORMATION
This *ONLY* happens for QQC2 spinboxes (QML). It does not happen with QSpinBox.
I'm unsure if Breeze is the correct location to file this bug. Please move as neccessary.
Comment 1 ratijas 2022-09-11 18:43:25 UTC
Created attachment 151993 [details]
QQC2 kde desktop style SpinBox hover glitch

Can confirm. Moreover, this looks like an upstream bug in QQC2. Attaching a video showing the problem. Hover flag does not reset as soon as mouse leaves the up/down.indicator's bounding box, and somehow they assume the hovered state when mouse re-enters their SpinBox even though up/down.hovered is off.
Comment 2 ratijas 2022-09-11 20:48:43 UTC
Those are actually two different bugs. I managed to fix the one that's in out implementation of QStyle bridge, namely in KQuickStyleItem.
Comment 3 ratijas 2022-09-11 23:46:50 UTC
Now, this is something "interesting":

    down.onHoveredChanged: print("DOWN H", down.hovered)
    down.onPressedChanged: print("DOWN P", down.pressed)
    up.onHoveredChanged: print("UP H", up.hovered)
    up.onPressedChanged: print("UP P", up.pressed)


> ❯ qml spins.qml
> QQmlApplicationEngine failed to load component
> file:///home/ratijas/tmp/spins.qml:17:9: Type SpinBox unavailable
> file:///usr/local/kde/lib/qml/QtQuick/Controls.2/org.kde.desktop/SpinBox.qml:96:8: ".onHoveredChanged" is not available due to component versioning.
> qml: Did not load any objects, exiting.

Excuse me, wat? Not available due to component versioning? With all latest *.15 imports? Whatever, that still works with two Connections objects.


Back on topic, the second part of the issue seems to be due to the TextField as a contentItem blocking hover events from propagating up to the SpinBox control itself. Note that the field itself is padded within this control, so there's a thin edge that resets the cursor when mouse enters the control, but because TextField and up/down buttons are immediately adjacent to each other — SpinBox don't get a chance to test for contains() and reset hovered properties.
Comment 4 Bug Janitor Service 2022-09-12 01:07:12 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/qqc2-desktop-style/-/merge_requests/187
Comment 5 Bug Janitor Service 2022-09-12 01:07:14 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/qqc2-desktop-style/-/merge_requests/187
Comment 6 ratijas 2022-09-12 23:13:16 UTC
Git commit fdd5457cd4474b51ea6aad45a10081530b2750f5 by ivan tkachenko.
Committed on 12/09/2022 at 00:08.
Pushed by ratijas into branch 'master'.

SpinBox: Reset activeSubControls when neither of indicators are active

Otherwise, an indicator remains in an active state even after being
released and unhovered.

M  +2    -0    plugin/kquickstyleitem.cpp

https://invent.kde.org/frameworks/qqc2-desktop-style/commit/fdd5457cd4474b51ea6aad45a10081530b2750f5
Comment 7 ratijas 2022-09-12 23:13:24 UTC
Git commit 7d94e6cb59808a85b12b713c41a3015f9a6cf0a0 by ivan tkachenko.
Committed on 12/09/2022 at 00:03.
Pushed by ratijas into branch 'master'.

SpinBox: Let hover events propagate through TextField to the control

Otherwise, up/down indicators won't update their hovered states, and
will be displayed incorrectly.

M  +1    -0    org.kde.desktop/SpinBox.qml

https://invent.kde.org/frameworks/qqc2-desktop-style/commit/7d94e6cb59808a85b12b713c41a3015f9a6cf0a0