digitaltrails / vdu_controls

VDU controls - a control panel for monitor brightness/contrast/...
GNU General Public License v3.0
103 stars 4 forks source link

Suggestion: Click on slider → set to the clicked value #59

Closed nahoj closed 10 months ago

nahoj commented 10 months ago

Currently, if my screen brightness is set to 100, and I click on the slider around the 50 mark, brigness will switch to 90, then 80, etc.

I wonder if you've considered making the value jump directly to the clicked abscissa instead, e.g. 50. This is the behavior of the standard "Power and brightness" plasmoid, for instance.

The small increments/decrements are something that's always bugged me in ddcui. I think just clicking on the desired value is more practical, especially considering that the value change has a bit of lag and may fail when done in quick succession (https://github.com/digitaltrails/vdu_controls/issues/58), e.g. clicking 5 times to get from 100 to 50.

digitaltrails commented 10 months ago

Good suggestion. This isn't the normal behaviour of the Qt QSlider. It looks simple to change:https://stackoverflow.com/questions/11132597/qslider-mouse-direct-jump

I hadn't noticed the annoyance because I haven't used the sliders much since implementing Presets, and not at all since implementing lux-metering.

digitaltrails commented 10 months ago

The best answer is: https://stackoverflow.com/a/29639127/609575. It's not the perfect answer for vdu_controls, but it can be altered to (which is actually less code):

class ClickableSlider(QSlider):  # loosely based on https://stackoverflow.com/a/29639127/609575

    def mousePressEvent(self, ev):  # On mouse click, set value to the value at the click position
        self.setValue(QStyle.sliderValueFromPosition(self.minimum(), self.maximum(), ev.x(), self.width()))
        super().mousePressEvent(ev)
digitaltrails commented 10 months ago

Nice easy improvement. It seems to work fine and doesn't degrade dragging response.

digitaltrails commented 10 months ago

I'll look at adding a floating tool-tip on hover. Nah, the tooltips look ugly, the codes messy, and the way qt draws them can be glitchy at times.

nahoj commented 10 months ago

Nice, thank you.