Skip to content
Snippets Groups Projects
Commit ff1d34fe authored by tatiana.novikova's avatar tatiana.novikova
Browse files

[+] Add focus handler to always set focus into console input area

parent 61fafcec
No related branches found
No related tags found
3 merge requests!115Bugs 3089,!114Bugs 3089,!110Bugs 3089
Pipeline #1889 failed with stage
in 1 second
......@@ -25,7 +25,6 @@ DapConsoleRightPanelForm
//Returns true if item 'someElement' is already exist at list 'someModel'.
function findElement(someModel, someElement)
{
console.log("someElement.query", someElement.query)
for(var i = 0; i < someModel.count; ++i)
if(someModel.get(i).query === someElement.query)
{
......
......@@ -19,6 +19,8 @@ DapConsoleScreenForm
{
//The start point for using history
consoleHistoryIndex = modelConsoleCommand.count
//Set focus to console input
consoleInput.forceActiveFocus()
}
QtObject
......@@ -86,9 +88,10 @@ DapConsoleScreenForm
//Send command fron right history panel
onHistoryCommandChanged:
{
sendCommand = historyCommand;
runCommand(sendCommand)
consoleHistoryIndex = modelConsoleCommand.count + 1;
sendCommand = historyCommand;
runCommand(sendCommand);
consoleHistoryIndex = modelConsoleCommand.count + 1;
consoleInput.forceActiveFocus();
}
//Using KeyUp and KeyDown to serf on console history
......@@ -107,4 +110,5 @@ DapConsoleScreenForm
currentCommand = modelConsoleCommand.get(consoleHistoryIndex).query;
return;
}
}
......@@ -16,6 +16,8 @@ DapAbstractScreen
property alias currentCommand: consoleCmd.text
///@detalis consoleHistoryIndex Index for using KeyUp and KeyDown to the navigation in console history.
property int consoleHistoryIndex
///@detalis consoleInput Reference to console input area
property alias consoleInput: consoleCmd
Rectangle
{
......@@ -26,20 +28,22 @@ DapAbstractScreen
anchors.rightMargin: 20 * pt
anchors.bottomMargin: 20 * pt
ListView
{
id: listViewConsoleCommand
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
height: (contentHeight < consoleRectangle.height - inputCommand.height) ? contentHeight : consoleRectangle.height - inputCommand.height
height: (contentHeight < consoleRectangle.height - inputCommand.height) ?
contentHeight :
consoleRectangle.height - inputCommand.height
clip: true
model: modelConsoleCommand
delegate: delegateConsoleCommand
currentIndex: count - 1
highlightFollowsCurrentItem: true
highlightRangeMode: ListView.ApplyRange
DapScrollViewHandling
{
id: scrollHandler
......@@ -75,17 +79,20 @@ DapAbstractScreen
selectByMouse: true
focus: true
font: themeConsole.inputCommandFont
Keys.onReturnPressed: text.length > 0 ? sendedCommand = text : sendedCommand = ""
Keys.onEnterPressed: text.length > 0 ? sendedCommand = text : sendedCommand = ""
Keys.onReturnPressed: text.length > 0 ?
sendedCommand = text :
sendedCommand = ""
Keys.onEnterPressed: text.length > 0 ?
sendedCommand = text :
sendedCommand = ""
Keys.onUpPressed: (consoleHistoryIndex > 0) ?
consoleHistoryIndex -= 1 :
null
Keys.onDownPressed: (consoleHistoryIndex < modelConsoleCommand.count) ?
consoleHistoryIndex += 1:
consoleHistoryIndex += 1 :
null
}
}
}
}
DapScrollView
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment