Fix focus problems for submenues in context menues
This commit is contained in:
parent
902f13ab68
commit
d828312a24
|
@ -8,6 +8,7 @@ import CppUtils 0.1
|
||||||
Menu {
|
Menu {
|
||||||
id: menu
|
id: menu
|
||||||
|
|
||||||
|
property bool isSubMenu: false
|
||||||
property var previouslyFocused: null
|
property var previouslyFocused: null
|
||||||
|
|
||||||
// MenuItems that open popups (or other elements taking focus when opened)
|
// MenuItems that open popups (or other elements taking focus when opened)
|
||||||
|
@ -57,6 +58,7 @@ Menu {
|
||||||
}
|
}
|
||||||
|
|
||||||
onAboutToShow: {
|
onAboutToShow: {
|
||||||
|
if (isSubMenu) return
|
||||||
previouslyFocused = window.activeFocusItem
|
previouslyFocused = window.activeFocusItem
|
||||||
focusOnClosed = Qt.binding(() => previouslyFocused)
|
focusOnClosed = Qt.binding(() => previouslyFocused)
|
||||||
}
|
}
|
||||||
|
|
|
@ -149,6 +149,7 @@ HTile {
|
||||||
|
|
||||||
HMenu {
|
HMenu {
|
||||||
title: qsTr("Notifications")
|
title: qsTr("Notifications")
|
||||||
|
isSubMenu: true
|
||||||
|
|
||||||
HMenuItem {
|
HMenuItem {
|
||||||
text: qsTr("Use default account settings")
|
text: qsTr("Use default account settings")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user