[vlc-commits] qml: allow ScrollingText to manage center aligned text

Prince Gupta git at videolan.org
Mon Aug 10 12:09:36 CEST 2020


vlc | branch: master | Prince Gupta <guptaprince8832 at gmail.com> | Thu Jul 23 01:10:22 2020 +0530| [a8ba5735a53d8c1e6c05b115202fd42f9e4b53c5] | committer: Pierre Lamot

qml: allow ScrollingText to manage center aligned text

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

 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



More information about the vlc-commits mailing list