[vlc-devel] [PATCH 5/5] qml: add missing dependencies on the interface scale for dp sizes

Pierre Lamot pierre at videolabs.io
Tue Sep 1 18:33:31 CEST 2020


---
 .../dialogs/toolbar/qml/EditorDNDDelegate.qml  |  2 +-
 .../qt/dialogs/toolbar/qml/EditorDNDView.qml   |  2 +-
 .../gui/qt/medialibrary/qml/MainDisplay.qml    |  2 +-
 .../qt/medialibrary/qml/MusicArtistsAlbums.qml |  2 +-
 modules/gui/qt/player/qml/ControlButtons.qml   |  6 +++---
 modules/gui/qt/player/qml/MiniPlayer.qml       |  6 +++---
 modules/gui/qt/player/qml/SliderBar.qml        |  6 +++---
 modules/gui/qt/player/qml/VolumeWidget.qml     | 18 +++++++++---------
 modules/gui/qt/playlist/qml/PLItem.qml         |  2 +-
 .../gui/qt/playlist/qml/PlaylistListView.qml   |  6 +++---
 modules/gui/qt/widgets/qml/DNDLabel.qml        | 10 +++++-----
 modules/gui/qt/widgets/qml/GridItem.qml        |  2 +-
 .../qt/widgets/qml/HorizontalResizeHandle.qml  |  2 +-
 .../qt/widgets/qml/KeyNavigableListView.qml    |  4 ++--
 modules/gui/qt/widgets/qml/PointingTooltip.qml | 14 +++++++-------
 modules/gui/qt/widgets/qml/SpinBoxExt.qml      | 12 ++++++------
 .../gui/qt/widgets/qml/VideoProgressBar.qml    |  2 +-
 17 files changed, 49 insertions(+), 49 deletions(-)

diff --git a/modules/gui/qt/dialogs/toolbar/qml/EditorDNDDelegate.qml b/modules/gui/qt/dialogs/toolbar/qml/EditorDNDDelegate.qml
index a19bd46cd1..2503c127ba 100644
--- a/modules/gui/qt/dialogs/toolbar/qml/EditorDNDDelegate.qml
+++ b/modules/gui/qt/dialogs/toolbar/qml/EditorDNDDelegate.qml
@@ -39,7 +39,7 @@ MouseArea {
 
     Rectangle {
         z: 1
-        width: VLCStyle.dp(2)
+        width: VLCStyle.dp(2, VLCStyle.scale)
         height: parent.height
         anchors {
             left: parent.left
diff --git a/modules/gui/qt/dialogs/toolbar/qml/EditorDNDView.qml b/modules/gui/qt/dialogs/toolbar/qml/EditorDNDView.qml
index 5b340f7ebe..0b4b4cf54f 100644
--- a/modules/gui/qt/dialogs/toolbar/qml/EditorDNDView.qml
+++ b/modules/gui/qt/dialogs/toolbar/qml/EditorDNDView.qml
@@ -46,7 +46,7 @@ ListView {
         property bool dropVisible: false
         Rectangle {
             z: 2
-            width: VLCStyle.dp(2)
+            width: VLCStyle.dp(2, VLCStyle.scale)
             height: parent.height
             anchors {
                 left: parent.left
diff --git a/modules/gui/qt/medialibrary/qml/MainDisplay.qml b/modules/gui/qt/medialibrary/qml/MainDisplay.qml
index bd034041b0..2c99109102 100644
--- a/modules/gui/qt/medialibrary/qml/MainDisplay.qml
+++ b/modules/gui/qt/medialibrary/qml/MainDisplay.qml
@@ -226,7 +226,7 @@ Widgets.NavigableFocusScope {
                                 PropertyChanges {
                                     target: playlistColumn
                                     width: resizeHandle.clamp(root.width / resizeHandle.widthFactor,
-                                                              VLCStyle.dp(225),
+                                                              VLCStyle.dp(225, VLCStyle.scale),
                                                               root.width / 2)
                                     visible: true
                                 }
diff --git a/modules/gui/qt/medialibrary/qml/MusicArtistsAlbums.qml b/modules/gui/qt/medialibrary/qml/MusicArtistsAlbums.qml
index 1215bc4c22..53a76fffa6 100644
--- a/modules/gui/qt/medialibrary/qml/MusicArtistsAlbums.qml
+++ b/modules/gui/qt/medialibrary/qml/MusicArtistsAlbums.qml
@@ -159,7 +159,7 @@ Widgets.NavigableFocusScope {
                         width: VLCStyle.play_cover_small
                         radius: VLCStyle.play_cover_small
                         color: 'transparent'
-                        border.width: VLCStyle.dp(1, scale)
+                        border.width: VLCStyle.dp(1, VLCStyle.scale)
                         border.color: !_highlighted ? VLCStyle.colors.roundPlayCoverBorder : VLCStyle.colors.accent
                     }
                 }
diff --git a/modules/gui/qt/player/qml/ControlButtons.qml b/modules/gui/qt/player/qml/ControlButtons.qml
index d3cfcffff1..864ab7ec14 100644
--- a/modules/gui/qt/player/qml/ControlButtons.qml
+++ b/modules/gui/qt/player/qml/ControlButtons.qml
@@ -214,7 +214,7 @@ Item{
                     id: playBtnMouseArea
 
                     anchors.fill: parent
-                    anchors.margins: VLCStyle.dp(1)
+                    anchors.margins: VLCStyle.dp(1, VLCStyle.scale)
 
                     hoverEnabled: true
 
@@ -255,7 +255,7 @@ Item{
                 Rectangle {
                     radius: (width * 0.5)
                     anchors.fill: parent
-                    anchors.margins: VLCStyle.dp(1)
+                    anchors.margins: VLCStyle.dp(1, VLCStyle.scale)
 
                     color: VLCStyle.colors.white
                     opacity: playBtn.videoOverlays ? 0.4 : 1.0
@@ -319,7 +319,7 @@ Item{
                     anchors.fill: parent
 
                     radius: (width * 0.5)
-                    border.width: VLCStyle.dp(2)
+                    border.width: VLCStyle.dp(2, VLCStyle.scale)
 
                     color: "transparent"
                     visible: false
diff --git a/modules/gui/qt/player/qml/MiniPlayer.qml b/modules/gui/qt/player/qml/MiniPlayer.qml
index 760002f7dc..7156c49496 100644
--- a/modules/gui/qt/player/qml/MiniPlayer.qml
+++ b/modules/gui/qt/player/qml/MiniPlayer.qml
@@ -67,7 +67,7 @@ Widgets.NavigableFocusScope {
         anchors.left: parent.left
         anchors.right: parent.right
 
-        spacing: VLCStyle.dp(-progressBar.height / 2)
+        spacing: VLCStyle.dp(-progressBar.height / 2, VLCStyle.scale)
 
         SliderBar {
             id: progressBar
@@ -172,8 +172,8 @@ Widgets.NavigableFocusScope {
                                         : VLCStyle.noArtAlbum
                                 fillMode: Image.PreserveAspectFit
 
-                                width: VLCStyle.dp(60)
-                                height: VLCStyle.dp(60)
+                                width: VLCStyle.dp(60, VLCStyle.scale)
+                                height: VLCStyle.dp(60, VLCStyle.scale)
                             }
                         }
 
diff --git a/modules/gui/qt/player/qml/SliderBar.qml b/modules/gui/qt/player/qml/SliderBar.qml
index 3b1e95e566..3103484283 100644
--- a/modules/gui/qt/player/qml/SliderBar.qml
+++ b/modules/gui/qt/player/qml/SliderBar.qml
@@ -26,7 +26,7 @@ import "qrc:///style/"
 Slider {
     id: control
 
-    property int barHeight: isMiniplayer ? VLCStyle.dp(3) : VLCStyle.dp(5)
+    property int barHeight: isMiniplayer ? VLCStyle.dp(3, VLCStyle.scale) : VLCStyle.dp(5, VLCStyle.scale)
     property bool _isHold: false
     property bool _isSeekPointsShown: true
     property bool isMiniplayer: false
@@ -124,7 +124,7 @@ Slider {
 
         Rectangle {
             id: bufferRect
-            property int bufferAnimWidth: VLCStyle.dp(100)
+            property int bufferAnimWidth: VLCStyle.dp(100, VLCStyle.scale)
             property int bufferAnimPosition: 0
             property int bufferFrames: 1000
             property alias animateLoading: loadingAnim.running
@@ -207,7 +207,7 @@ Slider {
                     property real position: model.position === undefined ? 0.0 : model.position
 
                     color: VLCStyle.colors.seekpoint
-                    width: VLCStyle.dp(1)
+                    width: VLCStyle.dp(1, VLCStyle.scale)
                     height: control.barHeight
                     x: sliderRect.width * seekpointsRect.position
                 }
diff --git a/modules/gui/qt/player/qml/VolumeWidget.qml b/modules/gui/qt/player/qml/VolumeWidget.qml
index fb215b690d..ba54380566 100644
--- a/modules/gui/qt/player/qml/VolumeWidget.qml
+++ b/modules/gui/qt/player/qml/VolumeWidget.qml
@@ -64,10 +64,10 @@ FocusScope{
         Slider
         {
             id: volControl
-            width: VLCStyle.dp(100)
+            width: VLCStyle.dp(100, VLCStyle.scale)
             height: parent.height
 
-            anchors.margins: VLCStyle.dp(5)
+            anchors.margins: VLCStyle.dp(5, VLCStyle.scale)
             from: 0
             to: maxvolpos
             stepSize: 0.05
@@ -155,10 +155,10 @@ FocusScope{
                 x: volControl.leftPadding
                 y: volControl.topPadding + volControl.availableHeight / 2 - height / 2
                 implicitWidth: parent.width
-                implicitHeight: VLCStyle.dp(4)
+                implicitHeight: VLCStyle.dp(4, VLCStyle.scale)
                 height: implicitHeight
                 width: volControl.availableWidth
-                radius: VLCStyle.dp(4)
+                radius: VLCStyle.dp(4, VLCStyle.scale)
                 color: VLCStyle.colors.volsliderbg
 
                 MouseArea {
@@ -166,7 +166,7 @@ FocusScope{
                     property bool isEntered: false
 
                     width: parent.width
-                    height: parent.height + VLCStyle.dp(60)
+                    height: parent.height + VLCStyle.dp(60, VLCStyle.scale)
                     anchors.verticalCenter: parent.verticalCenter
                     hoverEnabled: true
 
@@ -189,7 +189,7 @@ FocusScope{
                     id: filled
                     width: volControl.visualPosition * sliderBg.width
                     height: parent.height
-                    radius: VLCStyle.dp(4)
+                    radius: VLCStyle.dp(4, VLCStyle.scale)
                     color: widgetfscope.color
                     layer.enabled: (volControl.hovered || volControl.activeFocus)
                     layer.effect: LinearGradient {
@@ -206,9 +206,9 @@ FocusScope{
                 Rectangle{
                     id: tickmark
                     x : parent.width * volControl.fullvolpos
-                    width: VLCStyle.dp(1)
+                    width: VLCStyle.dp(1, VLCStyle.scale)
                     height: parent.height
-                    radius: VLCStyle.dp(2)
+                    radius: VLCStyle.dp(2, VLCStyle.scale)
                     color: widgetfscope.color
                 }
             }
@@ -218,7 +218,7 @@ FocusScope{
                 x: volControl.leftPadding + volControl.visualPosition * (volControl.availableWidth - width)
                 y: volControl.topPadding + volControl.availableHeight / 2 - height / 2
 
-                implicitWidth: VLCStyle.dp(8)
+                implicitWidth: VLCStyle.dp(8, VLCStyle.scale)
                 implicitHeight: implicitWidth
                 radius: width * 0.5
                 visible: (volControl.hovered || volControl.activeFocus)
diff --git a/modules/gui/qt/playlist/qml/PLItem.qml b/modules/gui/qt/playlist/qml/PLItem.qml
index bdc5ef4445..4c08acf164 100644
--- a/modules/gui/qt/playlist/qml/PLItem.qml
+++ b/modules/gui/qt/playlist/qml/PLItem.qml
@@ -155,7 +155,7 @@ Rectangle {
             if (dragItem.visible)
             {
                 var pos = this.mapToGlobal( mouseX, mouseY)
-                dragItem.updatePos(pos.x + VLCStyle.dp(15), pos.y)
+                dragItem.updatePos(pos.x + VLCStyle.dp(15, VLCStyle.scale), pos.y)
             }
         }
 
diff --git a/modules/gui/qt/playlist/qml/PlaylistListView.qml b/modules/gui/qt/playlist/qml/PlaylistListView.qml
index b85001de7c..ac7af1a892 100644
--- a/modules/gui/qt/playlist/qml/PlaylistListView.qml
+++ b/modules/gui/qt/playlist/qml/PlaylistListView.qml
@@ -659,7 +659,7 @@ Widgets.NavigableFocusScope {
                     visible: plmodel.count === 0
 
                     Widgets.IconLabel {
-                        font.pixelSize: VLCStyle.dp(48)
+                        font.pixelSize: VLCStyle.dp(48, VLCStyle.scale)
                         anchors.horizontalCenter: parent.horizontalCenter
                         horizontalAlignment: Text.AlignHCenter
                         verticalAlignment: Text.AlignVCenter
@@ -704,8 +704,8 @@ Widgets.NavigableFocusScope {
 	                anchors.bottom: parent.bottom
 	                anchors.horizontalCenter: parent.horizontalCenter
 
-	                width: infoText.width + VLCStyle.dp(18)
-	                height: infoText.height + VLCStyle.dp(12)
+                    width: infoText.width + VLCStyle.dp(18, VLCStyle.scale)
+                    height: infoText.height + VLCStyle.dp(12, VLCStyle.scale)
 
 	                glowRadius: 2
 	                cornerRadius: 10
diff --git a/modules/gui/qt/widgets/qml/DNDLabel.qml b/modules/gui/qt/widgets/qml/DNDLabel.qml
index 9b7796a961..48b7b3167a 100644
--- a/modules/gui/qt/widgets/qml/DNDLabel.qml
+++ b/modules/gui/qt/widgets/qml/DNDLabel.qml
@@ -49,15 +49,15 @@ Rectangle {
 
     RectangularGlow {
         anchors.fill: parent
-        glowRadius: VLCStyle.dp(8)
+        glowRadius: VLCStyle.dp(8, VLCStyle.scale)
         color: _colors.glowColor
         spread: 0.2
     }
 
     Text {
         id: label
-        width: implicitWidth + VLCStyle.dp(10)
-        height: implicitHeight + VLCStyle.dp(10)
+        width: implicitWidth + VLCStyle.dp(10, VLCStyle.scale)
+        height: implicitHeight + VLCStyle.dp(10, VLCStyle.scale)
         font.pixelSize: VLCStyle.fontSize_normal
         color: _colors.text
         text: i18n.qtr("%1 tracks selected").arg(count)
@@ -76,8 +76,8 @@ Rectangle {
 
         RowLayout {
             id: content
-            width: implicitWidth + VLCStyle.dp(10)
-            height: implicitHeight + VLCStyle.dp(10)
+            width: implicitWidth + VLCStyle.dp(10, VLCStyle.scale)
+            height: implicitHeight + VLCStyle.dp(10, VLCStyle.scale)
             Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
 
             Item {
diff --git a/modules/gui/qt/widgets/qml/GridItem.qml b/modules/gui/qt/widgets/qml/GridItem.qml
index c5a7af0aa2..f3b10399ea 100644
--- a/modules/gui/qt/widgets/qml/GridItem.qml
+++ b/modules/gui/qt/widgets/qml/GridItem.qml
@@ -167,7 +167,7 @@ Item {
                 source: baseRect
                 horizontalOffset: 0
                 verticalOffset: VLCStyle.dp(6, VLCStyle.scale)
-                radius: VLCStyle.dp(14, scale)
+                radius: VLCStyle.dp(14, VLCStyle.scale)
                 spread: 0
                 samples: ( radius * 2 ) + 1
                 color: Qt.rgba(0, 0, 0, .22)
diff --git a/modules/gui/qt/widgets/qml/HorizontalResizeHandle.qml b/modules/gui/qt/widgets/qml/HorizontalResizeHandle.qml
index c86cbefa8e..7fa16f9b89 100644
--- a/modules/gui/qt/widgets/qml/HorizontalResizeHandle.qml
+++ b/modules/gui/qt/widgets/qml/HorizontalResizeHandle.qml
@@ -38,7 +38,7 @@ MouseArea {
     property int _previousX
 
     cursorShape: Qt.SplitHCursor
-    width: VLCStyle.dp(8)
+    width: VLCStyle.dp(8, VLCStyle.scale)
     acceptedButtons: Qt.LeftButton
 
     onPressed: _previousX = mouseX
diff --git a/modules/gui/qt/widgets/qml/KeyNavigableListView.qml b/modules/gui/qt/widgets/qml/KeyNavigableListView.qml
index 7759971dff..9d417ef690 100644
--- a/modules/gui/qt/widgets/qml/KeyNavigableListView.qml
+++ b/modules/gui/qt/widgets/qml/KeyNavigableListView.qml
@@ -275,7 +275,7 @@ NavigableFocusScope {
             }
 
             gradient: Gradient {
-                GradientStop { position: 0.0; color: fadeColor }
+                GradientStop { position: 0.0; color: !!fadeColor ? fadeColor : "transparent" }
                 GradientStop { position: 1.0; color: "transparent" }
             }
         }
@@ -321,7 +321,7 @@ NavigableFocusScope {
 
             gradient: Gradient {
                 GradientStop { position: 0.0; color: "transparent" }
-                GradientStop { position: 1.0; color: fadeColor }
+                GradientStop { position: 1.0; color: !!fadeColor ? fadeColor : "transparent" }
             }
         }
     }
diff --git a/modules/gui/qt/widgets/qml/PointingTooltip.qml b/modules/gui/qt/widgets/qml/PointingTooltip.qml
index 5d8b216140..6ddc99fc92 100644
--- a/modules/gui/qt/widgets/qml/PointingTooltip.qml
+++ b/modules/gui/qt/widgets/qml/PointingTooltip.qml
@@ -90,8 +90,8 @@ Item {
 
         Rectangle {
             id: arrow
-            width: VLCStyle.dp(10)
-            height: VLCStyle.dp(10)
+            width: VLCStyle.dp(10, VLCStyle.scale)
+            height: VLCStyle.dp(10, VLCStyle.scale)
 
             anchors.centerIn: parent
             anchors.verticalCenterOffset: -(parent.height / 2)
@@ -105,7 +105,7 @@ Item {
 
             RectangularGlow {
                 anchors.fill: parent
-                glowRadius: VLCStyle.dp(2)
+                glowRadius: VLCStyle.dp(2, VLCStyle.scale)
                 spread: 0.2
                 color: VLCStyle.colors.glowColor
             }
@@ -114,16 +114,16 @@ Item {
 
     Rectangle {
         id: timeIndicatorRect
-        width: timeMetrics.width + VLCStyle.dp(10)
-        height: timeMetrics.height + VLCStyle.dp(5)
+        width: timeMetrics.width + VLCStyle.dp(10, VLCStyle.scale)
+        height: timeMetrics.height + VLCStyle.dp(5, VLCStyle.scale)
 
         color: VLCStyle.colors.bgAlt
-        radius: VLCStyle.dp(6)
+        radius: VLCStyle.dp(6, VLCStyle.scale)
 
         RectangularGlow {
             anchors.fill: parent
 
-            glowRadius: VLCStyle.dp(2)
+            glowRadius: VLCStyle.dp(2, VLCStyle.scale)
             cornerRadius: parent.radius
             spread: 0.2
 
diff --git a/modules/gui/qt/widgets/qml/SpinBoxExt.qml b/modules/gui/qt/widgets/qml/SpinBoxExt.qml
index 6ec44ec83e..2a55757e0c 100644
--- a/modules/gui/qt/widgets/qml/SpinBoxExt.qml
+++ b/modules/gui/qt/widgets/qml/SpinBoxExt.qml
@@ -30,8 +30,8 @@ SpinBox{
     property color borderColor:  VLCStyle.colors.buttonBorder
 
     background: Rectangle {
-        implicitWidth: VLCStyle.dp(4)
-        implicitHeight: VLCStyle.dp(32)
+        implicitWidth: VLCStyle.dp(4, VLCStyle.scale)
+        implicitHeight: VLCStyle.dp(32, VLCStyle.scale)
         border.color: control.borderColor
         color: control.bgColor
     }
@@ -52,8 +52,8 @@ SpinBox{
     up.indicator: Rectangle {
         x: parent.width - width
         height: parent.height / 2
-        implicitWidth: VLCStyle.dp(15)
-        implicitHeight: VLCStyle.dp(10)
+        implicitWidth: VLCStyle.dp(15, VLCStyle.scale)
+        implicitHeight: VLCStyle.dp(10, VLCStyle.scale)
         anchors.top: parent.top
         color: control.up.pressed ? VLCStyle.colors.bgHover : control.bgColor
         border.color: control.borderColor
@@ -72,8 +72,8 @@ SpinBox{
     down.indicator: Rectangle {
         x: parent.width - width
         height: parent.height / 2
-        implicitWidth: VLCStyle.dp(15)
-        implicitHeight: VLCStyle.dp(10)
+        implicitWidth: VLCStyle.dp(15, VLCStyle.scale)
+        implicitHeight: VLCStyle.dp(10, VLCStyle.scale)
         anchors.bottom: parent.bottom
         color: control.down.pressed ? VLCStyle.colors.bgHover : control.bgColor
         border.color: control.borderColor
diff --git a/modules/gui/qt/widgets/qml/VideoProgressBar.qml b/modules/gui/qt/widgets/qml/VideoProgressBar.qml
index f078912fac..51c9961c79 100644
--- a/modules/gui/qt/widgets/qml/VideoProgressBar.qml
+++ b/modules/gui/qt/widgets/qml/VideoProgressBar.qml
@@ -23,7 +23,7 @@ import "qrc:///style/"
 ProgressBar {
     id: progressBar
     background: Rectangle {
-        implicitHeight: VLCStyle.dp(2)
+        implicitHeight: VLCStyle.dp(2, VLCStyle.scale)
         color: VLCStyle.colors.text
     }
     contentItem: Item {
-- 
2.25.1



More information about the vlc-devel mailing list