fix: Change handling shortcuts for handling copy-paste

This commit is contained in:
Petr Mironychev
2025-09-28 15:12:55 +02:00
parent ff750c271a
commit c688cba3dd
4 changed files with 24 additions and 14 deletions

View File

@ -148,7 +148,9 @@ ChatRootView {
QQC.TextArea {
id: messageInput
placeholderText: qsTr("Type your message here...")
placeholderText: Qt.platform.os === "osx"
? qsTr("Type your message here... (⌘+↩ to send)")
: qsTr("Type your message here... (Ctrl+Enter to send)")
placeholderTextColor: palette.mid
color: palette.text
background: Rectangle {
@ -170,13 +172,6 @@ ChatRootView {
}
onTextChanged: root.calculateMessageTokensCount(messageInput.text)
Keys.onPressed: function(event) {
if ((event.key === Qt.Key_Return || event.key === Qt.Key_Enter) && !(event.modifiers & Qt.ShiftModifier)) {
root.sendChatMessage()
event.accepted = true;
}
}
}
}
@ -210,7 +205,10 @@ ChatRootView {
sendButton.onClicked: !root.isRequestInProgress ? root.sendChatMessage()
: root.cancelRequest()
isRequestInProgress: root.isRequestInProgress
sendButton.icon.source: !root.isRequestInProgress ? "qrc:/qt/qml/ChatView/icons/chat-icon.svg"
: "qrc:/qt/qml/ChatView/icons/chat-pause-icon.svg"
sendButton.ToolTip.text: !root.isRequestInProgress ? qsTr("Send message to LLM %1").arg(Qt.platform.os === "osx" ? "Cmd+Return" : "Ctrl+Return")
: qsTr("Stop")
syncOpenFiles {
checked: root.isSyncOpenFiles
onCheckedChanged: root.setIsSyncOpenFiles(bottomBar.syncOpenFiles.checked)
@ -220,6 +218,18 @@ ChatRootView {
}
}
Shortcut {
id: sendMessageShortcut
sequence: "Ctrl+Return"
context: Qt.WindowShortcut
onActivated: {
if (messageInput.activeFocus && !Qt.inputMethod.visible) {
root.sendChatMessage()
}
}
}
function clearChat() {
root.chatModel.clear()
root.clearAttachmentFiles()

View File

@ -30,7 +30,6 @@ Rectangle {
property alias attachFiles: attachFilesId
property alias linkFiles: linkFilesId
property bool isRequestInProgress: false
color: palette.window.hslLightness > 0.5 ?
Qt.darker(palette.window, 1.1) :
@ -53,15 +52,11 @@ Rectangle {
id: sendButtonId
icon {
source: !root.isRequestInProgress ? "qrc:/qt/qml/ChatView/icons/chat-icon.svg"
: "qrc:/qt/qml/ChatView/icons/chat-pause-icon.svg"
height: 15
width: 15
}
ToolTip.visible: hovered
ToolTip.delay: 250
ToolTip.text: !root.isRequestInProgress ? qsTr("Send message to LLM")
: qsTr("Stop")
}
QoAButton {