[vlc-devel] [PATCH 1/9] qml: use positioners instead of layout in GridItem

Prince Gupta guptaprince8832 at gmail.com
Mon Aug 10 15:20:22 CEST 2020


positioners don't allocate space for hidden items
---
 modules/gui/qt/widgets/qml/GridItem.qml | 25 ++++++-------------------
 1 file changed, 6 insertions(+), 19 deletions(-)

diff --git a/modules/gui/qt/widgets/qml/GridItem.qml b/modules/gui/qt/widgets/qml/GridItem.qml
index 17ada4ad7c..c5a7af0aa2 100644
--- a/modules/gui/qt/widgets/qml/GridItem.qml
+++ b/modules/gui/qt/widgets/qml/GridItem.qml
@@ -186,11 +186,10 @@ Item {
                 color: Qt.rgba(0, 0, 0, .18)
             }
 
-            ColumnLayout {
+            Column {
                 id: layout
 
                 anchors.centerIn: parent
-                spacing: 0
 
                 Widgets.MediaCover {
                     id: picture
@@ -200,10 +199,6 @@ Item {
                     playCoverVisible: root._highlighted
                     onPlayIconClicked: root.playClicked()
 
-                    Layout.preferredWidth: pictureWidth
-                    Layout.preferredHeight: pictureHeight
-                    Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter
-
                     /* new indicator (triangle at top-left of cover)*/
                     Rectangle {
                         id: newIndicator
@@ -226,11 +221,9 @@ Item {
 
                     label: titleLabel
                     scroll: _highlighted
-
-                    Layout.preferredHeight: titleLabel.contentHeight
-                    Layout.topMargin: root.titleMargin
-                    Layout.fillWidth: true
-                    Layout.maximumWidth: pictureWidth
+                    height: titleLabel.height
+                    width: titleLabel.width
+                    visible: root.title !== ""
 
                     Widgets.MenuLabel {
                         id: titleLabel
@@ -238,6 +231,7 @@ Item {
                         elide: Text.ElideNone
                         width: pictureWidth
                         horizontalAlignment: root.textHorizontalAlignment
+                        topPadding: root.titleMargin
                     }
                 }
 
@@ -246,14 +240,7 @@ Item {
 
                     visible: text !== ""
                     text: root.subtitle
-
-                    Layout.preferredHeight: implicitHeight
-                    Layout.maximumWidth: pictureWidth
-                    Layout.fillWidth: true
-                }
-
-                Item {
-                    Layout.fillHeight: true
+                    width: pictureWidth
                 }
             }
         }
-- 
2.25.1



More information about the vlc-devel mailing list