From 0693cd9ae76030535c164f6c8b0982b45f027870 Mon Sep 17 00:00:00 2001 From: Fatih Uzunoglu Date: Mon, 2 Jun 2025 22:55:17 +0300 Subject: [PATCH] qml: automatically request focus in `MainViewLoader` loaded item So that we don't need to use `focus: true` in every main view. We can do this because main views are expected to request focus. Currently views in `VideoAll` are missing this, instead of setting them there, I thought that this approach would be less fragile. Focus reason is a different matter and is not handled here. --- modules/gui/qt/maininterface/qml/MainViewLoader.qml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/modules/gui/qt/maininterface/qml/MainViewLoader.qml b/modules/gui/qt/maininterface/qml/MainViewLoader.qml index a06af99a03..f21fb5bc0f 100644 --- a/modules/gui/qt/maininterface/qml/MainViewLoader.qml +++ b/modules/gui/qt/maininterface/qml/MainViewLoader.qml @@ -224,4 +224,13 @@ Loader { sourceComponent: emptyLabel } + + // The encapsulating Loader is a focus scope. If it has active focus, + // is there any reason why its loaded item would not have focus? + Binding { + target: root.currentItem + when: root.activeFocus + property: "focus" + value: true + } }