[vlc-devel] [PATCH 04/25] qml: simplify scaling of center content in PlayerWidget

Prince Gupta guptaprince8832 at gmail.com
Thu Mar 11 09:16:12 UTC 2021


---
 modules/gui/qt/player/qml/Player.qml | 26 +++++++-------------------
 1 file changed, 7 insertions(+), 19 deletions(-)

diff --git a/modules/gui/qt/player/qml/Player.qml b/modules/gui/qt/player/qml/Player.qml
index 928b1ff8ec..95ce36d995 100644
--- a/modules/gui/qt/player/qml/Player.qml
+++ b/modules/gui/qt/player/qml/Player.qml
@@ -280,19 +280,14 @@ Widgets.NavigableFocusScope {
         }
 
         ColumnLayout {
-            anchors.fill: parent
+            anchors.centerIn: parent
             spacing: 0
             visible: !rootPlayer.hasEmbededVideo
 
             Item {
-                Layout.fillHeight: true
-            }
-
-            Item {
-                Layout.preferredHeight: Math.max(Math.min(parent.height, parent.width - VLCStyle.margin_small * 2), 0)
-                Layout.maximumHeight: rootPlayer.height / 2.7182
-                Layout.minimumHeight: 1
+                Layout.preferredHeight: rootPlayer.height / 2.7182
                 Layout.preferredWidth: height * cover.sar
+                Layout.maximumHeight: centerContent.height
                 Layout.alignment: Qt.AlignHCenter
 
                 Image {
@@ -319,8 +314,7 @@ Widgets.NavigableFocusScope {
             Widgets.SubtitleLabel {
                 id: albumLabel
 
-                Layout.fillWidth: true
-                Layout.preferredHeight: implicitHeight
+                Layout.alignment: Qt.AlignHCenter
                 Layout.topMargin: VLCStyle.margin_xxlarge
 
                 visible: centerContent.height > (albumLabel.y + albumLabel.height)
@@ -334,8 +328,7 @@ Widgets.NavigableFocusScope {
             Widgets.MenuLabel {
                 id: artistLabel
 
-                Layout.fillWidth: true
-                Layout.preferredHeight: implicitHeight
+                Layout.alignment: Qt.AlignHCenter
                 Layout.topMargin: VLCStyle.margin_small
 
                 visible: centerContent.height > (artistLabel.y + artistLabel.height)
@@ -349,10 +342,9 @@ Widgets.NavigableFocusScope {
             Widgets.NavigableRow {
                 id: audioControls
 
-                Layout.preferredHeight: implicitHeight
-                Layout.preferredWidth: implicitWidth
-                Layout.topMargin: VLCStyle.margin_large
                 Layout.alignment: Qt.AlignHCenter
+                Layout.topMargin: VLCStyle.margin_large
+
                 visible: player.videoTracks.count === 0 && centerContent.height > (audioControls.y + audioControls.height)
                 focus: visible
                 spacing: VLCStyle.margin_xxsmall
@@ -386,10 +378,6 @@ Widgets.NavigableFocusScope {
                     }
                 }
             }
-
-            Item {
-                Layout.fillHeight: true
-            }
         }
     }
 
-- 
2.25.1



More information about the vlc-devel mailing list