[vlc-devel] [PATCH 20/27] qml: fix SortControl scaling issue

Fatih Uzunoglu fuzun54 at outlook.com
Fri Dec 4 00:01:55 CET 2020


This patch fixes the SortControl being improperly displaced in PlaylistToolbar when mainInterface scaling changes.
---
 .../gui/qt/maininterface/qml/BannerSources.qml |  1 +
 modules/gui/qt/widgets/qml/SortControl.qml     | 18 +++++++++++++++---
 2 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/modules/gui/qt/maininterface/qml/BannerSources.qml b/modules/gui/qt/maininterface/qml/BannerSources.qml
index eaa6db3ee1..7a9a0c5617 100644
--- a/modules/gui/qt/maininterface/qml/BannerSources.qml
+++ b/modules/gui/qt/maininterface/qml/BannerSources.qml
@@ -238,6 +238,7 @@ Widgets.NavigableFocusScope {
                             criteriaRole: "criteria"
                             listWidth: VLCStyle.widthSortBox
                             height: localToolbar.height
+                            size: VLCStyle.banner_icon_size
 
                             popupAlignment: Qt.AlignLeft | Qt.AlignBottom
 
diff --git a/modules/gui/qt/widgets/qml/SortControl.qml b/modules/gui/qt/widgets/qml/SortControl.qml
index 1b7e677e96..73fec4bc46 100644
--- a/modules/gui/qt/widgets/qml/SortControl.qml
+++ b/modules/gui/qt/widgets/qml/SortControl.qml
@@ -27,8 +27,13 @@ import "qrc:///widgets/" as Widgets
 Widgets.NavigableFocusScope {
     id: root
 
-    width: childrenRect.width
-    height: childrenRect.height
+    // when height/width is explicitly set (force size), implicit values will not be used.
+    // when height/width is not explicitly set, IconToolButton will set its ...
+    // height and width to these implicit counterparts because ...
+    // height and width will be set to implicit values when they are not ...
+    // explicitly set.
+    implicitWidth: button.implicitWidth
+    implicitHeight: button.implicitHeight
 
     property alias model: list.model
     property string textRole
@@ -48,6 +53,8 @@ Widgets.NavigableFocusScope {
 
     property bool _intSortOrder : false
 
+    property alias size: button.size
+
     signal sortSelected(var modelData)
     signal sortOrderSelected(var order)
 
@@ -64,7 +71,12 @@ Widgets.NavigableFocusScope {
     Widgets.IconToolButton {
         id: button
 
-        size: VLCStyle.banner_icon_size
+        // set height and width to root height and width so that ...
+        // we can forcefully set SortControl's width and height.
+        height: root.height
+        width: root.width
+
+        size: VLCStyle.icon_normal
         iconText: VLCIcons.topbar_sort
         text: i18n.qtr("Sort")
 
-- 
2.27.0



More information about the vlc-devel mailing list