Restore previous focus after HPopup closed
This commit is contained in:
@@ -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()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user