Restore focus to previous item on console exit
This commit is contained in:
		@@ -16,6 +16,8 @@ HDrawer {
 | 
			
		||||
    z: 9999
 | 
			
		||||
    position: 0
 | 
			
		||||
 | 
			
		||||
    property var previouslyFocusedItem: null
 | 
			
		||||
 | 
			
		||||
    property var target: null
 | 
			
		||||
    property alias t: debugConsole.target
 | 
			
		||||
 | 
			
		||||
@@ -53,7 +55,6 @@ HDrawer {
 | 
			
		||||
            mainUI.shortcuts.debugConsole.destroy()
 | 
			
		||||
 | 
			
		||||
        mainUI.shortcuts.debugConsole = debugConsole
 | 
			
		||||
        forceActiveFocus()
 | 
			
		||||
        position = 1
 | 
			
		||||
        commandsView.model.insert(0, {
 | 
			
		||||
            input: "t = " + String(target),
 | 
			
		||||
@@ -62,6 +63,15 @@ HDrawer {
 | 
			
		||||
        })
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    onVisibleChanged: {
 | 
			
		||||
        if (visible) {
 | 
			
		||||
            previouslyFocusedItem = window.activeFocusItem
 | 
			
		||||
            forceActiveFocus()
 | 
			
		||||
        } else if (previouslyFocusedItem) {
 | 
			
		||||
            previouslyFocusedItem.forceActiveFocus()
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    onHistoryEntryChanged:
 | 
			
		||||
        inputField.text =
 | 
			
		||||
            historyEntry === -1 ? "" : history.slice(-historyEntry - 1)[0]
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user