[vlc-commits] qml: set the focus on the first section in list in NetworkHomeDisplay
Pierre Lamot
git at videolan.org
Thu Feb 13 11:06:41 CET 2020
vlc | branch: master | Pierre Lamot <pierre at videolabs.io> | Mon Jan 27 17:54:47 2020 +0100| [3fdd0e4a872e1cb48318bc55a6a087d91927245c] | committer: Jean-Baptiste Kempf
qml: set the focus on the first section in list in NetworkHomeDisplay
This used to set the focus on the first section loaded which may not be
natural
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=3fdd0e4a872e1cb48318bc55a6a087d91927245c
---
modules/gui/qt/network/qml/NetworkHomeDisplay.qml | 20 +++++++++++++++-----
1 file changed, 15 insertions(+), 5 deletions(-)
diff --git a/modules/gui/qt/network/qml/NetworkHomeDisplay.qml b/modules/gui/qt/network/qml/NetworkHomeDisplay.qml
index 6e538a32d7..4008172510 100644
--- a/modules/gui/qt/network/qml/NetworkHomeDisplay.qml
+++ b/modules/gui/qt/network/qml/NetworkHomeDisplay.qml
@@ -169,11 +169,21 @@ Widgets.NavigableFocusScope {
Component.onCompleted: resetFocus()
onActiveFocusChanged: resetFocus()
function resetFocus() {
- if (!deviceSection.focus && !lanSection.focus) {
- if (deviceSection.visible)
- deviceSection.focus = true
- else if (lanSection.visible)
- lanSection.focus = true
+ var widgetlist = [deviceSection, lanSection]
+ var i;
+ for (i in widgetlist) {
+ if (widgetlist[i].activeFocus && widgetlist[i].visible)
+ return
+ }
+
+ var found = false;
+ for (i in widgetlist) {
+ if (widgetlist[i].visible && !found) {
+ widgetlist[i].focus = true
+ found = true
+ } else {
+ widgetlist[i].focus = false
+ }
}
}
}
More information about the vlc-commits
mailing list