[vlc-commits] qml: revise sliderbar tooltip

Fatih Uzunoglu git at videolan.org
Thu Aug 27 12:44:32 CEST 2020


vlc | branch: master | Fatih Uzunoglu <fuzun54 at outlook.com> | Mon Jul 27 19:49:25 2020 +0300| [9c68eb74c8d12a23268762697856201405ad306e] | committer: Pierre Lamot

qml: revise sliderbar tooltip

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

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

 modules/gui/qt/player/qml/SliderBar.qml | 44 ++++++++++++++++++++++++---------
 1 file changed, 33 insertions(+), 11 deletions(-)

diff --git a/modules/gui/qt/player/qml/SliderBar.qml b/modules/gui/qt/player/qml/SliderBar.qml
index a00a767b11..2769dac5ef 100644
--- a/modules/gui/qt/player/qml/SliderBar.qml
+++ b/modules/gui/qt/player/qml/SliderBar.qml
@@ -44,32 +44,54 @@ Slider {
         property real location: sliderRectMouseArea.mouseX
         property real position: location/control.width
 
-        y: VLCStyle.dp(-35)
+        y: -(childrenRect.height)
         x: location - (timeIndicatorRect.width / 2)
         visible: control.hovered
 
-        Rectangle {
-            width: VLCStyle.dp(10)
-            height: VLCStyle.dp(10)
+        Item {
+            height: childrenRect.height * Math.sqrt(2)
+            width: timeIndicatorRect.width
 
             anchors.horizontalCenter: timeIndicatorRect.horizontalCenter
             anchors.verticalCenter: timeIndicatorRect.bottom
+            anchors.verticalCenterOffset: height / 2
 
-            rotation: 45
-            color: VLCStyle.colors.bgAlt
+            clip: true
+
+            Rectangle {
+                id: arrow
+                width: VLCStyle.dp(10)
+                height: VLCStyle.dp(10)
+
+                anchors.centerIn: parent
+                anchors.verticalCenterOffset: -(parent.height / 2)
+
+                color: VLCStyle.colors.bgAlt
+
+                rotation: 45
+            }
         }
 
         Rectangle {
             id: timeIndicatorRect
-            width: childrenRect.width
-            height: VLCStyle.dp(20)
+            width: timeMetrics.width + VLCStyle.dp(10)
+            height: timeMetrics.height + VLCStyle.dp(5)
             color: VLCStyle.colors.bgAlt
 
             Text {
-                text: player.length.scale(timeTooltip.position).toString() +
-                      (player.hasChapters ?
-                           " - " + player.chapters.getNameAtPosition(timeTooltip.position) : "")
+                anchors.fill: parent
+                text: timeMetrics.text
                 color: VLCStyle.colors.text
+
+                horizontalAlignment: Text.AlignHCenter
+                verticalAlignment: Text.AlignVCenter
+
+                TextMetrics {
+                    id: timeMetrics
+                    text: player.length.scale(timeTooltip.position).toString() +
+                          (player.hasChapters ?
+                               " - " + player.chapters.getNameAtPosition(timeTooltip.position) : "")
+                }
             }
         }
     }



More information about the vlc-commits mailing list