vlc | branch: master | Pierre Lamot <pie...@videolabs.io> | Thu Sep 19 15:40:00 
2019 +0200| [15b6495881da5845a106076d0a56792dbb5d2a51] | committer: 
Jean-Baptiste Kempf

qml: allow to set position of SortControl popup

Signed-off-by: Jean-Baptiste Kempf <j...@videolan.org>

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

 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

_______________________________________________
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits

Reply via email to