From 744164e6c92cb721d2a339cee8c465e1685723f9 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Mon, 10 Jul 2017 16:48:07 +0200 Subject: Fix focus handling for popups When a popup is closed, if there are multiple popups open, restore focus to the next popup in chain instead of transferring focus to the window content. This allows us to cleanup the custom focus handling for sub-menus in dev. There is no more need to manually transfer focus to the parent menu or to a sub-menu, but calling open() or close() is enough and the focus is automatically transferred as expected. Change-Id: I54406c7c6b8dd25af261e00ebb1ae00ccbea8b9f Reviewed-by: Mitch Curtis --- .../auto/applicationwindow/data/focusAfterPopupClosed.qml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'tests/auto/applicationwindow/data') diff --git a/tests/auto/applicationwindow/data/focusAfterPopupClosed.qml b/tests/auto/applicationwindow/data/focusAfterPopupClosed.qml index 015e03bc..f0499a3a 100644 --- a/tests/auto/applicationwindow/data/focusAfterPopupClosed.qml +++ b/tests/auto/applicationwindow/data/focusAfterPopupClosed.qml @@ -57,9 +57,12 @@ ApplicationWindow { visible: true signal focusScopeKeyPressed + signal focusPopupKeyPressed + property alias fileMenu: fileMenu property alias toolButton: toolButton property alias focusScope: focusScope + property alias focusPopup: focusPopup header: ToolBar { ToolButton { @@ -92,5 +95,17 @@ ApplicationWindow { Keys.onSpacePressed: focusScopeKeyPressed() } + + Popup { + id: focusPopup + focus: true + width: parent.width + height: parent.height + + Item { + focus: true + Keys.onSpacePressed: focusPopupKeyPressed() + } + } } -- cgit v1.2.3