[vlc-commits] qml: add a signal to notify data changes rather than index change in SortControl
Pierre Lamot
git at videolan.org
Tue Nov 19 16:50:13 CET 2019
vlc | branch: master | Pierre Lamot <pierre at videolabs.io> | Mon Nov 18 13:09:10 2019 +0100| [0181e780588552011afc7fce41010b9cc0e7f026] | committer: Jean-Baptiste Kempf
qml: add a signal to notify data changes rather than index change in SortControl
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=0181e780588552011afc7fce41010b9cc0e7f026
---
modules/gui/qt/qml/BannerSources.qml | 7 +++----
modules/gui/qt/qml/utils/SortControl.qml | 4 ++++
2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/modules/gui/qt/qml/BannerSources.qml b/modules/gui/qt/qml/BannerSources.qml
index 7e034b96cb..7536db68f0 100644
--- a/modules/gui/qt/qml/BannerSources.qml
+++ b/modules/gui/qt/qml/BannerSources.qml
@@ -217,10 +217,9 @@ Utils.NavigableFocusScope {
visible: !!root.contentModel
enabled: visible
- onCurrentIndexChanged: {
- if (model !== undefined && contentModel !== undefined) {
- var sorting = model.get(currentIndex);
- contentModel.sortCriteria = sorting.criteria
+ onSortSelected: {
+ if (contentModel !== undefined) {
+ contentModel.sortCriteria = modelData.criteria
}
}
}
diff --git a/modules/gui/qt/qml/utils/SortControl.qml b/modules/gui/qt/qml/utils/SortControl.qml
index 091b9ed66f..93b61b88d0 100644
--- a/modules/gui/qt/qml/utils/SortControl.qml
+++ b/modules/gui/qt/qml/utils/SortControl.qml
@@ -34,6 +34,9 @@ Utils.NavigableFocusScope {
property int popupAlignment: Qt.AlignRight | Qt.AlignBottom
property int listWidth
property alias currentIndex: list.currentIndex
+ property alias focusPolicy: button.focusPolicy
+
+ signal sortSelected(var modelData)
onFocusChanged: {
if (!focus)
@@ -145,6 +148,7 @@ Utils.NavigableFocusScope {
onClicked: {
root.currentIndex = index
+ root.sortSelected(model)
popup.close()
}
}
More information about the vlc-commits
mailing list