Skip to content

Add relative (to current value) dragging to the slider spinbox widget

Deif Lou requested to merge deiflou/krita:deiflou/sliderspinbox_nojump into master

Some users want the slider spinbox to have a mode so that the value does not jump to where the user clicked, but to mantain it's value and then move relatively when dragging (similar to blender sliders). (See this KA thread for some discussion on the subject).

So I made some small changes to allow this:

  • Now if the user is pressing Shift when they press with the pointer, the "relative mode" kicks in and the value will not be set to where they clicked, but changed relative to the old value when dragging.
  • If the user clicks on an area around the current value +-15px the relative mode also is activated. The rationale for this is that if the user takes the time to click close to the current value they probably want to slightly modify the current value and not set a completely new one. This is also a way of using the relative mode with no keyboard.
  • All other interaction should work as before

Formalities Checklist

  • I confirmed this builds.
  • I confirmed Krita ran and the relevant functions work.
  • I tested the relevant unit tests and can confirm they are not broken. (If not possible, don't hesitate to ask for help!)
  • I made sure my commits build individually and have good descriptions as per KDE guidelines.
  • I made sure my code conforms to the standards set in the HACKING file.
  • I can confirm the code is licensed and attributed appropriately, and that unattributed code is mine, as per KDE Licensing Policy.

Merge request reports