[vlc-commits] [Git][videolan/vlc][master] qml: refactor implicit size bindings for Qt 5.12 and use insets

Steve Lhomme (@robUx4) gitlab at videolan.org
Thu May 25 11:24:48 UTC 2023



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
8e3fff08 by Fatih Uzunoglu at 2023-05-25T11:06:05+00:00
qml: refactor implicit size bindings for Qt 5.12 and use insets

- - - - -


14 changed files:

- modules/gui/qt/network/qml/AddressbarButton.qml
- modules/gui/qt/player/qml/MiniPlayer.qml
- modules/gui/qt/player/qml/controlbarcontrols/TeletextWidget.qml
- modules/gui/qt/player/qml/controlbarcontrols/VolumeWidget.qml
- modules/gui/qt/playlist/qml/PlaylistDelegate.qml
- modules/gui/qt/widgets/qml/BannerTabButton.qml
- modules/gui/qt/widgets/qml/CSDWindowButton.qml
- modules/gui/qt/widgets/qml/IconToolButton.qml
- modules/gui/qt/widgets/qml/NavigableRow.qml
- modules/gui/qt/widgets/qml/OverlayMenu.qml
- modules/gui/qt/widgets/qml/ScanProgressBar.qml
- modules/gui/qt/widgets/qml/Slider.qml
- modules/gui/qt/widgets/qml/TextToolButton.qml
- modules/gui/qt/widgets/qml/ToolTipExt.qml


Changes:

=====================================
modules/gui/qt/network/qml/AddressbarButton.qml
=====================================
@@ -37,10 +37,11 @@ T.AbstractButton {
 
     // Settings
 
-    implicitWidth: Math.max(background.implicitWidth,
-            (contentItem ? contentItem.implicitWidth : 0) + leftPadding + rightPadding)
-    implicitHeight: Math.max(background.implicitHeight,
-            (contentItem ? contentItem.implicitHeight : 0) + topPadding + bottomPadding)
+    implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+                            implicitContentWidth + leftPadding + rightPadding)
+    implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+                             implicitContentHeight + topPadding + bottomPadding)
+
     baselineOffset: contentItem ? contentItem.y + contentItem.baselineOffset : 0
 
 


=====================================
modules/gui/qt/player/qml/MiniPlayer.qml
=====================================
@@ -31,8 +31,10 @@ T.Pane {
 
     height: 0
 
-    implicitWidth: Math.max(background ? background.implicitWidth : 0, contentItem.implicitWidth + leftPadding + rightPadding)
-    implicitHeight: Math.max(background ? background.implicitHeight : 0, contentItem.implicitHeight + topPadding + bottomPadding)
+    implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+                            implicitContentWidth + leftPadding + rightPadding)
+    implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+                             implicitContentHeight + topPadding + bottomPadding)
 
     visible: false
 


=====================================
modules/gui/qt/player/qml/controlbarcontrols/TeletextWidget.qml
=====================================
@@ -28,11 +28,10 @@ import "qrc:///style/"
 T.Pane {
     id: root
 
-    implicitWidth: Math.max(background ? background.implicitWidth : 0,
-                            contentWidth + leftPadding + rightPadding)
-
-    implicitHeight: Math.max(background ? background.implicitHeight : 0,
-                             contentHeight + topPadding + bottomPadding)
+    implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+                            implicitContentWidth + leftPadding + rightPadding)
+    implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+                             implicitContentHeight + topPadding + bottomPadding)
 
     contentWidth: column.implicitWidth
     contentHeight: column.implicitHeight


=====================================
modules/gui/qt/player/qml/controlbarcontrols/VolumeWidget.qml
=====================================
@@ -40,8 +40,10 @@ T.Pane {
     readonly property real _fullvolpos: 100 / _maxvol
     readonly property real _maxvolpos: _maxvol / 100
 
-    implicitWidth: Math.max(background ? background.implicitWidth : 0, contentWidth + leftPadding + rightPadding)
-    implicitHeight: Math.max(background ? background.implicitHeight : 0, contentHeight + topPadding + bottomPadding)
+    implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+                            implicitContentWidth + leftPadding + rightPadding)
+    implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+                             implicitContentHeight + topPadding + bottomPadding)
 
     contentWidth: volumeWidget.implicitWidth
     contentHeight: volumeWidget.implicitHeight


=====================================
modules/gui/qt/playlist/qml/PlaylistDelegate.qml
=====================================
@@ -52,11 +52,10 @@ T.ItemDelegate {
 
     rightPadding: Math.max(listView.scrollBarWidth, VLCStyle.margin_normal)
 
-    implicitWidth: Math.max(background.implicitWidth,
-                            contentItem.implicitWidth + leftPadding + rightPadding)
-
-    implicitHeight: Math.max(background.implicitHeight,
-                            contentItem.implicitHeight + topPadding + bottomPadding)
+    implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+                            implicitContentWidth + leftPadding + rightPadding)
+    implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+                             implicitContentHeight + topPadding + bottomPadding)
 
     ListView.delayRemove: mouseArea.drag.active
 


=====================================
modules/gui/qt/widgets/qml/BannerTabButton.qml
=====================================
@@ -44,8 +44,10 @@ T.TabButton {
 
     height: implicitHeight
 
-    implicitWidth: contentItem.implicitWidth
-    implicitHeight: contentItem.implicitHeight
+    implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+                            implicitContentWidth + leftPadding + rightPadding)
+    implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+                             implicitContentHeight + topPadding + bottomPadding)
 
     padding: 0
 


=====================================
modules/gui/qt/widgets/qml/CSDWindowButton.qml
=====================================
@@ -36,8 +36,12 @@ T.Button {
 
     padding: 0
     width: VLCStyle.dp(40, VLCStyle.scale)
-    implicitWidth: contentItem.implicitWidth
-    implicitHeight: contentItem.implicitHeight
+
+    implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+                            implicitContentWidth + leftPadding + rightPadding)
+    implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+                             implicitContentHeight + topPadding + bottomPadding)
+
     focusPolicy: Qt.NoFocus
 
     background: Rectangle {


=====================================
modules/gui/qt/widgets/qml/IconToolButton.qml
=====================================
@@ -45,10 +45,11 @@ T.ToolButton {
 
     enabled: !paintOnly
 
-    implicitWidth: Math.max(background ? background.implicitWidth : 0,
-                            contentItem.implicitWidth + leftPadding + rightPadding)
-    implicitHeight: Math.max(background ? background.implicitHeight : 0,
-                             contentItem.implicitHeight + topPadding + bottomPadding)
+    implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+                            implicitContentWidth + leftPadding + rightPadding)
+    implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+                             implicitContentHeight + topPadding + bottomPadding)
+
     baselineOffset: contentItem.y + contentItem.baselineOffset
 
     // Keys


=====================================
modules/gui/qt/widgets/qml/NavigableRow.qml
=====================================
@@ -39,10 +39,10 @@ T.Control {
 
     // Settings
 
-    implicitWidth: Math.max(background ? background.implicitWidth : 0,
-        (contentItem ? contentItem.implicitWidth : 0) + leftPadding + rightPadding)
-    implicitHeight: Math.max(background ? background.implicitHeight : 0,
-        (contentItem ? contentItem.implicitHeight : 0) + topPadding + bottomPadding)
+    implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+                            implicitContentWidth + leftPadding + rightPadding)
+    implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+                             implicitContentHeight + topPadding + bottomPadding)
 
     Navigation.navigable: (_countEnabled > 0)
 


=====================================
modules/gui/qt/widgets/qml/OverlayMenu.qml
=====================================
@@ -198,10 +198,11 @@ FocusScope {
             delegate: T.AbstractButton {
                 id: button
 
-                implicitWidth: Math.max(background ? background.implicitWidth : 0,
-                                        (contentItem ? contentItem.implicitWidth : 0) + leftPadding + rightPadding)
-                implicitHeight: Math.max(background ? background.implicitHeight : 0,
-                                         (contentItem ? contentItem.implicitHeight : 0) + topPadding + bottomPadding)
+                implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+                                        implicitContentWidth + leftPadding + rightPadding)
+                implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+                                         implicitContentHeight + topPadding + bottomPadding)
+
                 baselineOffset: contentItem ? contentItem.y + contentItem.baselineOffset : 0
 
                 readonly property bool yieldsAnotherModel: (!!modelData.model)


=====================================
modules/gui/qt/widgets/qml/ScanProgressBar.qml
=====================================
@@ -28,10 +28,10 @@ import "qrc:///style/"
 T.ProgressBar {
     id: control
 
-    implicitWidth: Math.max(background ? background.implicitWidth : 0,
-                            contentItem.implicitWidth + leftPadding + rightPadding)
-    implicitHeight: Math.max(background ? background.implicitHeight : 0,
-                             contentItem.implicitHeight + topPadding + bottomPadding)
+    implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+                            implicitContentWidth + leftPadding + rightPadding)
+    implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+                             implicitContentHeight + topPadding + bottomPadding)
 
     rightPadding: VLCStyle.margin_large
     leftPadding: VLCStyle.margin_large


=====================================
modules/gui/qt/widgets/qml/Slider.qml
=====================================
@@ -77,10 +77,10 @@ T.Slider {
         return (x - offset) / extend
     }
 
-    implicitWidth: Math.max(background ? background.implicitWidth : 0,
-                           (handle ? handle.implicitWidth : 0) + leftPadding + rightPadding)
-    implicitHeight: Math.max(background ? background.implicitHeight : 0,
-                            (handle ? handle.implicitHeight : 0) + topPadding + bottomPadding)
+    implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+                            implicitHandleWidth + leftPadding + rightPadding)
+    implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+                             implicitHandleHeight + topPadding + bottomPadding)
 
     handle: Rectangle {
         x: control.leftPadding + (control.horizontal


=====================================
modules/gui/qt/widgets/qml/TextToolButton.qml
=====================================
@@ -27,8 +27,10 @@ T.ToolButton {
 
     font.pixelSize: VLCStyle.fontSize_normal
 
-    implicitWidth: contentItem.implicitWidth + leftPadding + rightPadding
-    implicitHeight: contentItem.implicitHeight + topPadding + bottomPadding
+    implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+                            implicitContentWidth + leftPadding + rightPadding)
+    implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+                             implicitContentHeight + topPadding + bottomPadding)
 
     padding: VLCStyle.margin_xxsmall
 


=====================================
modules/gui/qt/widgets/qml/ToolTipExt.qml
=====================================
@@ -28,10 +28,10 @@ T.ToolTip {
     x: 0
     y: -implicitHeight - VLCStyle.margin_xxxsmall
 
-    implicitWidth: Math.max(background ? background.implicitWidth : 0,
-                            contentItem.implicitWidth + leftPadding + rightPadding)
-    implicitHeight: Math.max(background ? background.implicitHeight : 0,
-                             contentItem.implicitHeight + topPadding + bottomPadding)
+    implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+                            implicitContentWidth + leftPadding + rightPadding)
+    implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+                             implicitContentHeight + topPadding + bottomPadding)
 
     margins: VLCStyle.margin_xsmall
     padding: VLCStyle.margin_xsmall



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/8e3fff08a3d617761f7d7b0e55ba6323d0f79287

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/8e3fff08a3d617761f7d7b0e55ba6323d0f79287
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