Skip to content

Commit

Permalink
ChatView: make context menus more intuitive (#2324)
Browse files Browse the repository at this point in the history
* ChatView: fix deprecation warning

Signed-off-by: Jared Van Bortel <jared@nomic.ai>

* ChatView: make context menus more intuitive

Signed-off-by: Jared Van Bortel <jared@nomic.ai>

---------

Signed-off-by: Jared Van Bortel <jared@nomic.ai>
  • Loading branch information
cebtenzzre committed May 9, 2024
1 parent cef74c2 commit d54e644
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions gpt4all-chat/qml/ChatView.qml
Expand Up @@ -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
Expand All @@ -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()
}
}
}

Expand Down Expand Up @@ -1441,7 +1449,7 @@ Rectangle {
anchors.fill: parent
acceptedButtons: Qt.RightButton

onClicked: {
onClicked: (mouse) => {
if (mouse.button === Qt.RightButton) {
textInputContextMenu.x = textInputMouseArea.mouseX
textInputContextMenu.y = textInputMouseArea.mouseY
Expand All @@ -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 {
Expand Down

0 comments on commit d54e644

Please sign in to comment.