[vlc-commits] qml: center content in GridItems

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


vlc | branch: master | Prince Gupta <guptaprince8832 at gmail.com> | Fri Jul 24 18:06:48 2020 +0530| [e8b335efc4968abf86bbab84b55bb67d4f44bae5] | committer: Pierre Lamot

qml: center content in GridItems

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

 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 {



More information about the vlc-commits mailing list