[vlc-devel] [PATCH 26/29] qml: center content in GridItems

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


---
 modules/gui/qt/widgets/qml/GridItem.qml | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/modules/gui/qt/widgets/qml/GridItem.qml b/modules/gui/qt/widgets/qml/GridItem.qml
index e74f6d553a..17ada4ad7c 100644
--- a/modules/gui/qt/widgets/qml/GridItem.qml
+++ b/modules/gui/qt/widgets/qml/GridItem.qml
@@ -143,8 +143,8 @@ Item {
 
                 x: - root.selectedBorderWidth
                 y: - root.selectedBorderWidth
-                width: layout.implicitWidth + ( root.selectedBorderWidth * 2 )
-                height:  layout.implicitHeight + ( root.selectedBorderWidth * 2 )
+                width: root.width + ( root.selectedBorderWidth * 2 )
+                height:  root.height + ( root.selectedBorderWidth * 2 )
                 color: VLCStyle.colors.bgAlt
                 visible: root.selected || root._highlighted
             }
@@ -152,8 +152,8 @@ Item {
             Rectangle {
                 id: baseRect
 
-                x: 1 // this rect is set such that it hides behind picture component
-                y: 1
+                x: layout.x + 1 // this rect is set such that it hides behind picture component
+                y: layout.y + 1
                 width: pictureWidth - 2
                 height: pictureHeight - 2
                 radius: picture.radius
@@ -189,7 +189,7 @@ Item {
             ColumnLayout {
                 id: layout
 
-                anchors.fill: parent
+                anchors.centerIn: parent
                 spacing: 0
 
                 Widgets.MediaCover {
@@ -202,6 +202,7 @@ Item {
 
                     Layout.preferredWidth: pictureWidth
                     Layout.preferredHeight: pictureHeight
+                    Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter
 
                     /* new indicator (triangle at top-left of cover)*/
                     Rectangle {
-- 
2.25.1



More information about the vlc-devel mailing list