[vlc-commits] qml: fix SortControl scaling issue

Fatih Uzunoglu git at videolan.org
Mon Dec 7 10:08:38 UTC 2020


vlc | branch: master | Fatih Uzunoglu <fuzun54 at outlook.com> | Fri Dec  4 02:01:55 2020 +0300| [04c21a5e3972fdf7bf74e83b72bb102a09173f1e] | committer: Pierre Lamot

qml: fix SortControl scaling issue

This patch fixes the SortControl being improperly displaced in PlaylistToolbar when mainInterface scaling changes.

Signed-off-by: Pierre Lamot <pierre at videolabs.io>

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

 modules/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")
 



More information about the vlc-commits mailing list