[vlc-commits] [Git][videolan/vlc][master] 2 commits: qml: improve tooltip assignment in Slider

Steve Lhomme (@robUx4) gitlab at videolan.org
Mon May 15 15:01:02 UTC 2023



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
725daeb1 by Prince Gupta at 2023-05-15T14:13:11+00:00
qml: improve tooltip assignment in Slider

rename variable name to better reflect usecase

- - - - -
363d06f3 by Prince Gupta at 2023-05-15T14:13:11+00:00
qml: always show current volume in tooltip of volumewidget

fixes #28132

- - - - -


3 changed files:

- modules/gui/qt/player/qml/PlaybackSpeed.qml
- modules/gui/qt/player/qml/controlbarcontrols/VolumeWidget.qml
- modules/gui/qt/widgets/qml/Slider.qml


Changes:

=====================================
modules/gui/qt/player/qml/PlaybackSpeed.qml
=====================================
@@ -246,7 +246,7 @@ ColumnLayout {
 
         wheelEnabled: true
 
-        valueText: function (value) {
+        toolTipTextProvider: function (value) {
             return sliderToSpeed(value).toFixed(2)
         }
 


=====================================
modules/gui/qt/player/qml/controlbarcontrols/VolumeWidget.qml
=====================================
@@ -115,8 +115,12 @@ T.Pane {
 
             enabled: !root.paintOnly // disables event handling depending on this
 
-            valueText: function (value) {
-                return Math.round(value * 100) + "%"
+            toolTipTextProvider: function (value) {
+                // the real value i.e 'Player.volume' bounds can be different
+                // from bounds of this widget and we want to show the current
+                // volume here, so directly use Player.volume instead of "value"
+
+                return Math.round(Player.volume * 100) + "%"
             }
 
             Accessible.name: I18n.qtr("Volume")


=====================================
modules/gui/qt/widgets/qml/Slider.qml
=====================================
@@ -51,10 +51,13 @@ T.Slider {
     // else tooltip will always be shown at current value.
     property bool tooltipFollowsMouse: false
 
-    // valueText -> function(value)
-    // arg value is between from and to
-    // returns the text for the given value, used for tooltip etc.
-    property var valueText: function (value) {
+
+    // toolTipTextProvider -> function(value)
+    // arg "value" is between from and to, this is "value"
+    // at which pointing tool tip is currently shown
+    //
+    // returns the text for the given value
+    property var toolTipTextProvider: function (value) {
         return value
     }
 
@@ -153,7 +156,7 @@ T.Slider {
            if (!visible) return ""
 
            var v = control.valueAt(control.positionAt(pos.x))
-           return control.valueText(v)
+           return control.toolTipTextProvider(v)
        }
 
        //tooltip is a Popup, palette should be passed explicitly



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/fdbd4797fa511fb434ff1726d9274e3d8cb4f51f...363d06f3e852732ceb2a841c6804765599af48f9

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/fdbd4797fa511fb434ff1726d9274e3d8cb4f51f...363d06f3e852732ceb2a841c6804765599af48f9
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list