From b01ee4d0f59d01edb94976db0d49191c09e5ed65 Mon Sep 17 00:00:00 2001 From: Jared Van Bortel Date: Wed, 8 May 2024 18:52:49 -0400 Subject: [PATCH 1/2] ChatView: fix deprecation warning Signed-off-by: Jared Van Bortel --- gpt4all-chat/qml/ChatView.qml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gpt4all-chat/qml/ChatView.qml b/gpt4all-chat/qml/ChatView.qml index 23b2620ecf35..87f4f31f4d87 100644 --- a/gpt4all-chat/qml/ChatView.qml +++ b/gpt4all-chat/qml/ChatView.qml @@ -1069,7 +1069,7 @@ Rectangle { anchors.fill: parent acceptedButtons: Qt.RightButton - onClicked: { + onClicked: (mouse) => { if (mouse.button === Qt.RightButton) { conversationContextMenu.x = conversationMouseArea.mouseX conversationContextMenu.y = conversationMouseArea.mouseY @@ -1441,7 +1441,7 @@ Rectangle { anchors.fill: parent acceptedButtons: Qt.RightButton - onClicked: { + onClicked: (mouse) => { if (mouse.button === Qt.RightButton) { textInputContextMenu.x = textInputMouseArea.mouseX textInputContextMenu.y = textInputMouseArea.mouseY From 0aa6ab0a9653cb4f8cdef3ab9e818624c8b11dcb Mon Sep 17 00:00:00 2001 From: Jared Van Bortel Date: Wed, 8 May 2024 19:12:23 -0400 Subject: [PATCH 2/2] ChatView: make context menus more intuitive Signed-off-by: Jared Van Bortel --- gpt4all-chat/qml/ChatView.qml | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/gpt4all-chat/qml/ChatView.qml b/gpt4all-chat/qml/ChatView.qml index 87f4f31f4d87..9d59789261a6 100644 --- a/gpt4all-chat/qml/ChatView.qml +++ b/gpt4all-chat/qml/ChatView.qml @@ -1082,11 +1082,19 @@ Rectangle { id: conversationContextMenu MenuItem { text: qsTr("Copy") + enabled: myTextArea.selectedText !== "" + height: enabled ? implicitHeight : 0 onTriggered: myTextArea.copy() } MenuItem { - text: qsTr("Select All") - onTriggered: myTextArea.selectAll() + text: qsTr("Copy Message") + enabled: myTextArea.selectedText === "" + height: enabled ? implicitHeight : 0 + onTriggered: { + myTextArea.selectAll() + myTextArea.copy() + myTextArea.deselect() + } } } @@ -1454,10 +1462,14 @@ Rectangle { id: textInputContextMenu MenuItem { text: qsTr("Cut") + enabled: textInput.selectedText !== "" + height: enabled ? implicitHeight : 0 onTriggered: textInput.cut() } MenuItem { text: qsTr("Copy") + enabled: textInput.selectedText !== "" + height: enabled ? implicitHeight : 0 onTriggered: textInput.copy() } MenuItem {