Restore previous focus after HPopup closed
This commit is contained in:
parent
1bd012c871
commit
4b13b75617
@ -22,6 +22,11 @@ Popup {
|
|||||||
color: theme.controls.popup.background
|
color: theme.controls.popup.background
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onAboutToShow: previouslyFocused = window.activeFocusItem
|
||||||
|
onClosed: if (previouslyFocused) previouslyFocused.forceActiveFocus()
|
||||||
|
|
||||||
|
|
||||||
|
property var previouslyFocused: null
|
||||||
|
|
||||||
readonly property int maximumPreferredWidth:
|
readonly property int maximumPreferredWidth:
|
||||||
window.width - leftMargin - rightMargin - leftInset - rightInset
|
window.width - leftMargin - rightMargin - leftInset - rightInset
|
||||||
|
@ -17,7 +17,7 @@ HDrawer {
|
|||||||
z: 9999
|
z: 9999
|
||||||
position: 0
|
position: 0
|
||||||
|
|
||||||
property var previouslyFocusedItem: null
|
property var previouslyFocused: null
|
||||||
|
|
||||||
property var target: null
|
property var target: null
|
||||||
property alias t: debugConsole.target
|
property alias t: debugConsole.target
|
||||||
@ -66,10 +66,10 @@ HDrawer {
|
|||||||
|
|
||||||
onVisibleChanged: {
|
onVisibleChanged: {
|
||||||
if (visible) {
|
if (visible) {
|
||||||
previouslyFocusedItem = window.activeFocusItem
|
previouslyFocused = window.activeFocusItem
|
||||||
forceActiveFocus()
|
forceActiveFocus()
|
||||||
} else if (previouslyFocusedItem) {
|
} else if (previouslyFocused) {
|
||||||
previouslyFocusedItem.forceActiveFocus()
|
previouslyFocused.forceActiveFocus()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user