[vlc-devel] [PATCH 13/49] qml: allow to set position of SortControl popup

Pierre Lamot pierre at videolabs.io
Fri Oct 11 15:17:37 CEST 2019


---
 modules/gui/qt/qml/utils/SortControl.qml | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/modules/gui/qt/qml/utils/SortControl.qml b/modules/gui/qt/qml/utils/SortControl.qml
index 6350b3ef7f..72e65ace31 100644
--- a/modules/gui/qt/qml/utils/SortControl.qml
+++ b/modules/gui/qt/qml/utils/SortControl.qml
@@ -27,9 +27,11 @@ Utils.NavigableFocusScope {
     width: childrenRect.width
     height: childrenRect.height
 
-    property variant model
+    property alias model: list.model
     property string textRole
 
+
+    property int popupAlignment: Qt.AlignRight | Qt.AlignBottom
     property int listWidth
     property alias currentIndex: list.currentIndex
 
@@ -38,6 +40,11 @@ Utils.NavigableFocusScope {
             popup.close()
     }
 
+    onVisibleChanged: {
+        if (!visible)
+            popup.close()
+    }
+
     Utils.IconToolButton {
         id: button
 
@@ -57,8 +64,8 @@ Utils.NavigableFocusScope {
     Popup {
         id: popup
 
-        y: root.height - 1
-        x: button.width - width
+        y: (popupAlignment & Qt.AlignBottom) ? (root.height - 1) : 1
+        x: (popupAlignment & Qt.AlignRight) ? (button.width - width) :  0
         width: root.listWidth
         implicitHeight: contentItem.implicitHeight + padding * 2
         padding: 1
-- 
2.20.1



More information about the vlc-devel mailing list