Fix focus problems for submenues in context menues

This commit is contained in:
miruka 2021-03-02 09:34:31 -04:00
parent 902f13ab68
commit d828312a24
2 changed files with 3 additions and 0 deletions

View File

@ -8,6 +8,7 @@ import CppUtils 0.1
Menu {
id: menu
property bool isSubMenu: false
property var previouslyFocused: null
// MenuItems that open popups (or other elements taking focus when opened)
@ -57,6 +58,7 @@ Menu {
}
onAboutToShow: {
if (isSubMenu) return
previouslyFocused = window.activeFocusItem
focusOnClosed = Qt.binding(() => previouslyFocused)
}

View File

@ -149,6 +149,7 @@ HTile {
HMenu {
title: qsTr("Notifications")
isSubMenu: true
HMenuItem {
text: qsTr("Use default account settings")