Add context menus to the prompt and the responses

Signed-off-by: Kryotek <gcda@outlook.it>
This commit is contained in:
Kryotek 2024-03-11 23:45:42 +01:00 committed by AT
parent 11db71e0a7
commit afbb30a523

View File

@ -1057,6 +1057,32 @@ Window {
}
}
MouseArea {
id: conversationMouseArea
anchors.fill: parent
acceptedButtons: Qt.RightButton
onClicked: {
if (mouse.button === Qt.RightButton) {
conversationContextMenu.x = conversationMouseArea.mouseX
conversationContextMenu.y = conversationMouseArea.mouseY
conversationContextMenu.open()
}
}
}
Menu {
id: conversationContextMenu
MenuItem {
text: "Copy"
onTriggered: myTextArea.copy()
}
MenuItem {
text: "Select All"
onTriggered: myTextArea.selectAll()
}
}
ResponseText {
id: responseText
}
@ -1399,6 +1425,41 @@ Window {
MySettings.repeatPenaltyTokens)
textInput.text = ""
}
MouseArea {
id: textInputMouseArea
anchors.fill: parent
acceptedButtons: Qt.RightButton
onClicked: {
if (mouse.button === Qt.RightButton) {
textInputContextMenu.x = textInputMouseArea.mouseX
textInputContextMenu.y = textInputMouseArea.mouseY
textInputContextMenu.open()
}
}
}
Menu {
id: textInputContextMenu
MenuItem {
text: "Cut"
onTriggered: textInput.cut()
}
MenuItem {
text: "Copy"
onTriggered: textInput.copy()
}
MenuItem {
text: "Paste"
onTriggered: textInput.paste()
}
MenuItem {
text: "Select All"
onTriggered: textInput.selectAll()
}
}
}
}