[vlc-devel] [PATCH 12/29] qml: allow ScrollingText to manage center aligned text

Prince Gupta guptaprince8832 at gmail.com
Tue Aug 4 13:34:45 CEST 2020


---
 modules/gui/qt/widgets/qml/ScrollingText.qml | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/modules/gui/qt/widgets/qml/ScrollingText.qml b/modules/gui/qt/widgets/qml/ScrollingText.qml
index a9889987d1..92c147c6ad 100644
--- a/modules/gui/qt/widgets/qml/ScrollingText.qml
+++ b/modules/gui/qt/widgets/qml/ScrollingText.qml
@@ -46,7 +46,21 @@ Item {
             target: label
             property: "x"
             from: 0
-            to: label.width - label.contentWidth
+            to: (label.horizontalAlignment == Text.AlignHCenter) ? (label.width - label.contentWidth) / 2 : label.width - label.contentWidth
+
+            maximumEasingTime: 0
+            velocity: 20
+        }
+
+        PauseAnimation {
+            duration: 1000
+        }
+
+        SmoothedAnimation {
+            target: label
+            property: "x"
+            to: (label.horizontalAlignment == Text.AlignHCenter) ? (label.contentWidth - label.width) / 2 : label.width - label.contentWidth
+            duration: (label.horizontalAlignment == Text.AlignHCenter) ? -1 : 1
 
             maximumEasingTime: 0
             velocity: 20
-- 
2.25.1



More information about the vlc-devel mailing list