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