[vlc-devel] [PATCH 09/14] qml: set the focus on the first section in list in NetworkHomeDisplay
Pierre Lamot
pierre at videolabs.io
Thu Feb 6 13:56:46 CET 2020
This used to set the focus on the first section loaded which may not be
natural
---
.../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
+ }
}
}
}
--
2.17.1
More information about the vlc-devel
mailing list