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