Bug 482428

Summary: Scrolling over time-based comboboxes using a two-finger touchpad scroll malfunctions
Product: [Applications] systemsettings Reporter: Prasad Murthy <phoenix_firebrd>
Component: kcm_powerdevilAssignee: Plasma Bugs List <plasma-bugs-null>
Status: RESOLVED FIXED    
Severity: minor CC: emtorres1, jpetso, kde, natalie_clarius, nate
Priority: NOR Keywords: qt6
Version First Reported In: 6.0.0   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In: 6.1.0
Sentry Crash Report:

Description Prasad Murthy 2024-03-05 00:47:34 UTC
Using KDE Neon User edition, system was fully updated at the time of internally confirming the bug.

Software and Hardware specs.
-----------------------------------------------------------------------------------------
Operating System: KDE neon 6.0
KDE Plasma Version: 6.0.0
KDE Frameworks Version: 6.0.0
Qt Version: 6.6.2
Kernel Version: 6.6.20 (64-bit)
Graphics Platform: Wayland
Processors: 32 × AMD Ryzen 9 7950X 16-Core Processor
Memory: 31.1 GiB of RAM
Graphics Processor: NVIDIA GeForce RTX 3060 Ti/PCIe/SSE2
Manufacturer: ASUS
-----------------------------------------------------------------------------------------

Observed:-

I was trying to change the sleep timeout setting of the system using system settings. When I try to the timeout value using the mouse scroll wheel, the default time unit changes from minutes to seconds and there after any change, increment or decrement using the mouse scroll wheel occurs in seconds only.

Expected:-

The time units should range according, like if its more than 59 seconds then change the units to mins and if more than 59 mins then to hours and so on.

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Bellow is the URL to the video on Youtube illustrating the above

https://www.youtube.com/watch?v=Rce7-FVX9oU
Comment 1 Prasad Murthy 2024-03-05 00:53:06 UTC
CORRECTION:-
----------------------

The above given URL to the video is wrong, its of another bug. Kindly use the below URL, thanks.

https://www.youtube.com/watch?v=ZGjF_ptARq4
Comment 2 Nate Graham 2024-03-05 20:53:34 UTC
I also can reproduce this issue, but only when I scroll with a laptop touchpad, and not with a wheel mouse.
Comment 3 Nate Graham 2024-04-11 20:27:31 UTC
*** Bug 484092 has been marked as a duplicate of this bug. ***
Comment 4 Jakob Petsovits 2024-05-03 22:22:34 UTC
I can reproduce this with my laptop's trackpoint, which combined with the middle mouse button functions as a scroll wheel. My assumption is that this is an issue with Qt itself, which allows fine-grained scrolling on Wayland (yay) but in doing so decides to ignore the `stepSize` property (boo).

We could probably look into a fix for Qt. My personal plan to fix this is by replacing the SpinBox with a drop-down like the one we recently added to the Screen Locking KCM, which provides a few sensible preset durations plus a "Custom" option that opens a dialog with dedicated radio buttons to choose between minutes and seconds.
Comment 5 Bug Janitor Service 2024-05-15 17:30:37 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/powerdevil/-/merge_requests/358
Comment 6 Jakob Petsovits 2024-05-22 04:50:53 UTC
Git commit 511469e52d4676d6c71f66acaaf277a7efc25e1e by Jakob Petsovits.
Committed on 22/05/2024 at 04:36.
Pushed by jpetso into branch 'master'.

kcmodule: Switch to comboboxes for selecting idle timeout values

This follows the direction spearheaded by kcm_screenlocker,
in plasma/kscreenlocker commit 311db2a9. In addition to a few
select preset options, the user can also select a "Custom…"
option which presents a duration prompt dialog.

Using comboboxes has a few nice UX characteristics:

* It allows us to replace the checkbox of some timeout settings
  with a textual option called "Never", which is easier to grasp.
  Likewise, "Immediately" is more obvious than "0 sec".

* It increases the mouse area available for clicking, which makes
  the control easier to hit for users with low-precision pointer
  input devices.

* It sidesteps the problem of SpinBox ignoring the defined
  step size when scrolling with a high-resolution scroll wheel.

* By putting the SpinBox into a custom duration prompt dialog,
  it's more obvious that both seconds and minutes are supported
  for each setting. Some options also provide second-level presets.

The downside is that it now takes three extra clicks to enter
and confirm a custom timeout duration. Hopefully our users are
comfortable with that trade-off.

In order to implement this, the latest versions of the
ComboBoxWithCustomValue and DurationPromptDialog components
are copied from kcm_screenlocker. Several improvements to these
components will be fed back to kcm_screenlocker and hopefully
upstreamed to Kirigami (or Kirigami Addons) at a later time.

In addition, this commit introduces TimeDurationComboBox, a glue code
component combining two aforementioned components, to further
reduce the amount of boilerplate required in ProfileConfig.qml.
Related: bug 482853

A  +164  -0    kcmodule/profiles/ui/ComboBoxWithCustomValue.qml     [License: LGPL(v2.1+)]
A  +212  -0    kcmodule/profiles/ui/DurationPromptDialog.qml     [License: LGPL(v2.1+)]
M  +264  -104  kcmodule/profiles/ui/ProfileConfig.qml
D  +0    -49   kcmodule/profiles/ui/TimeDelaySpinBox.qml
A  +151  -0    kcmodule/profiles/ui/TimeDurationComboBox.qml     [License: LGPL(v2.1+)]

https://invent.kde.org/plasma/powerdevil/-/commit/511469e52d4676d6c71f66acaaf277a7efc25e1e
Comment 7 Jakob Petsovits 2024-05-22 05:23:26 UTC
I'll note that the "fix" referenced above looks a little different than the suggestion for expected behavior in comment #0.

> The time units should range according, like if its more than 59 seconds then
> change the units to mins and if more than 59 mins then to hours and so on.

I wanted to do this initially, but Qt Quick makes this sort of hard. The SpinBox component has a single field called "stepSize", it affects the value for both going up and going down. Now if I'm at 1 minute, what I would like is to go down by 1 second but up by 1 minute. This can't be done without terrible (and possibly buggy) hacks at the moment, as far as I'm aware.

So in the new UI, you get drop-downs with a few preset values instead, and if those preset values aren't what you're looking for, you can configure a custom value with the "Custom..." option. The dialog that presents the custom duration prompt will provide a SpinBox input field like before, but instead of combining value and time unit in the same field, it lets you choose between seconds and minutes through a pair of radio buttons to the right of the input field. This also solves the mentioned issue, though perhaps not in the way that you originally had in mind.