[vlc-commits] qt: improve volume slider control

Romain Vimont git at videolan.org
Mon Apr 12 08:14:56 UTC 2021


vlc | branch: master | Romain Vimont <rom1v at videolabs.io> | Wed Apr  7 18:27:06 2021 +0200| [a9bcc2cb04ee38c85d886091c0e03302858ad203] | committer: Pierre Lamot

qt: improve volume slider control

The slider has some width, which must be taken into account to compute
the volume.

This avoids to control the left of the handle near 0% but the right of
the handle near 125%. Instead, it always controls the center of the
handle.

Signed-off-by: Pierre Lamot <pierre at videolabs.io>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=a9bcc2cb04ee38c85d886091c0e03302858ad203
---

 modules/gui/qt/player/qml/VolumeWidget.qml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/modules/gui/qt/player/qml/VolumeWidget.qml b/modules/gui/qt/player/qml/VolumeWidget.qml
index 177ca6caae..6c325ae9ab 100644
--- a/modules/gui/qt/player/qml/VolumeWidget.qml
+++ b/modules/gui/qt/player/qml/VolumeWidget.qml
@@ -218,7 +218,7 @@ FocusScope{
                         }
 
                         if(pressed)
-                            volControl.value = volControl.maxvolpos * event.x / sliderMouseArea.width
+                            volControl.value = volControl.maxvolpos * (event.x - handle.width / 2) / (sliderMouseArea.width - handle.width)
                     }
 
                     onWheel: {



More information about the vlc-commits mailing list