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

[*] Change rules of keyUp and keyDown

[+] Add handler for the doubleClick on right history panel
parent 20ebffae
No related branches found
No related tags found
3 merge requests!115Bugs 3089,!114Bugs 3089,!110Bugs 3089
......@@ -7,6 +7,8 @@ DapConsoleRightPanelForm
property string commandQuery
///@detalis historyQuery Text of command from the command history.
property string historyQuery
///@detalis historyQueryIndex Index of command from the command history.
property string historyQueryIndex
///@detalis historySize Num of history command at right panel.
property int historySize: 10
......@@ -36,22 +38,28 @@ DapConsoleRightPanelForm
onCommandQueryChanged:
{
console.log("commandQuery", commandQuery)
//Adding only new element
if(!findElement(modelHistoryConsole, {query: commandQuery}))
{
if(commandQuery !== "")
{
modelHistoryConsole.insert(0, {query: commandQuery});
}
}
else
modelHistoryConsole.insert(0, {query: commandQuery});
//History is limited by historySize and realized as FIFO
if(historySize < modelHistoryConsole.count)
{
modelHistoryConsole.remove(modelHistoryConsole.count-1);
}
//Handler for the doubleClick on right history panel
onHistoryQueryIndexChanged:
{
if(historyQueryIndex > -1)
{
historyQuery = modelHistoryConsole.get(historyQueryIndex).query;
historyQueryIndex = -1;
historyQuery = ""
}
}
}
......@@ -65,7 +65,7 @@ DapAbstractRightPanel
{
id: historyQueryMouseArea
anchors.fill: textCommand
onDoubleClicked: historyQuery = textCommand.text
onDoubleClicked: historyQueryIndex = index
}
}
//It allows to see last element of list by default
......
......@@ -98,7 +98,6 @@ DapConsoleScreenForm
{
if(consoleHistoryIndex >= modelConsoleCommand.count)
{
consoleHistoryIndex = modelConsoleCommand.count + 1;
currentCommand = "";
return;
}
......
......@@ -77,8 +77,12 @@ DapAbstractScreen
font: themeConsole.inputCommandFont
Keys.onReturnPressed: text.length > 0 ? sendedCommand = text : sendedCommand = ""
Keys.onEnterPressed: text.length > 0 ? sendedCommand = text : sendedCommand = ""
Keys.onUpPressed: consoleHistoryIndex -= 1
Keys.onDownPressed: consoleHistoryIndex += 1
Keys.onUpPressed: (consoleHistoryIndex > 0) ?
consoleHistoryIndex -= 1 :
null
Keys.onDownPressed: (consoleHistoryIndex < modelConsoleCommand.count) ?
consoleHistoryIndex += 1:
null
}
}
......
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