gui: add submit button to prompt input

Add a ▶ button next to the text area for mouse-based submission.
Extract shared doSubmit() on the input RowLayout. Button uses
focusPolicy: Qt.NoFocus so it doesn't steal focus from the TextArea.
This commit is contained in:
Levi Neely 2026-08-28 13:40:14 +02:00
parent 9829498d57
commit 307687542c
1 changed files with 22 additions and 4 deletions

View File

@ -203,10 +203,18 @@ Item {
// Input
RowLayout {
id: inputRow
Layout.fillWidth: true
Layout.margins: 6
spacing: 4
function doSubmit() {
if (promptInput.text.trim() !== "") {
ollie.submit(promptInput.text.trim())
promptInput.text = ""
}
}
// TextArea in ScrollView for overflow, with context menu overlay
Item {
Layout.fillWidth: true
@ -246,10 +254,7 @@ Item {
if (event.modifiers & Qt.ShiftModifier) {
event.accepted = false
} else {
if (text.trim() !== "") {
ollie.submit(text.trim())
text = ""
}
inputRow.doSubmit()
event.accepted = true
}
}
@ -285,6 +290,19 @@ Item {
}
}
}
Button {
text: "▶"
Layout.alignment: Qt.AlignBottom
Layout.preferredWidth: 36
Layout.preferredHeight: 36
focusPolicy: Qt.NoFocus
enabled: promptInput.enabled && promptInput.text.trim() !== ""
onClicked: inputRow.doSubmit()
ToolTip.visible: hovered
ToolTip.text: "Send (Enter)"
}
}
}