[vlc-commits] [Git][videolan/vlc][master] qml: fix broken `ButtonExt.qml`

Steve Lhomme (@robUx4) gitlab at videolan.org
Fri Mar 14 11:04:34 UTC 2025



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
6c7ddb90 by Fatih Uzunoglu at 2025-03-14T10:50:40+00:00
qml: fix broken `ButtonExt.qml`

- Implicit size is not calculated correctly.
- Control's padding is not respected.
- Control's spacing is not respected.
- Text is not centered when there is more than enough width.
- Text is not elided when the control has less than enough width.

- - - - -


1 changed file:

- modules/gui/qt/widgets/qml/ButtonExt.qml


Changes:

=====================================
modules/gui/qt/widgets/qml/ButtonExt.qml
=====================================
@@ -50,13 +50,13 @@ T.Button {
 
     // Settings
 
-    width: implicitWidth
-    height: implicitHeight
+    implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+                            implicitContentWidth + leftPadding + rightPadding)
+    implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+                             implicitContentHeight + topPadding + bottomPadding)
 
-    implicitWidth: contentItem.implicitWidth
-    implicitHeight: contentItem.implicitHeight
-
-    padding: 0
+    padding: VLCStyle.margin_xsmall
+    spacing: VLCStyle.margin_xsmall
 
     font.pixelSize: VLCStyle.fontSize_normal
 
@@ -100,17 +100,15 @@ T.Button {
         implicitWidth: tabRow.implicitWidth
         implicitHeight: tabRow.implicitHeight
 
-        Row {
+        RowLayout {
             id: tabRow
 
             anchors.fill: parent
 
-            padding: VLCStyle.margin_xsmall
-            spacing: VLCStyle.margin_xsmall
+            spacing: control.spacing
 
             Item {
-                width: implicitWidth
-                height: implicitHeight
+                Layout.fillHeight: true
 
                 implicitWidth: VLCStyle.fontHeight_normal
                 implicitHeight: VLCStyle.fontHeight_normal
@@ -147,6 +145,12 @@ T.Button {
             }
 
             Widgets.ListLabel {
+                Layout.fillWidth: true
+                Layout.fillHeight: true
+
+                horizontalAlignment: Text.AlignHCenter
+                verticalAlignment: Text.AlignVCenter
+
                 text: control.text
 
                 //button text is already exposed



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/6c7ddb906a509646a048d87e998c47c000d4aa92

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/6c7ddb906a509646a048d87e998c47c000d4aa92
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list