mirror of
https://github.com/Palm1r/QodeAssist.git
synced 2025-10-28 06:44:32 -04:00
feat: Improve context menu for tool results in chat
This commit is contained in:
@ -18,6 +18,7 @@
|
||||
*/
|
||||
|
||||
import QtQuick
|
||||
import Qt.labs.platform as Platform
|
||||
|
||||
Rectangle {
|
||||
id: root
|
||||
@ -83,15 +84,47 @@ Rectangle {
|
||||
}
|
||||
spacing: 8
|
||||
|
||||
Text {
|
||||
TextEdit {
|
||||
id: resultText
|
||||
|
||||
width: parent.width
|
||||
text: root.toolResult
|
||||
wrapMode: Text.Wrap
|
||||
readOnly: true
|
||||
selectByMouse: true
|
||||
color: palette.text
|
||||
wrapMode: Text.WordWrap
|
||||
font.family: "monospace"
|
||||
font.pixelSize: 11
|
||||
color: palette.text
|
||||
selectionColor: palette.highlight
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
acceptedButtons: Qt.RightButton
|
||||
onClicked: contextMenu.open()
|
||||
propagateComposedEvents: true
|
||||
}
|
||||
|
||||
Platform.Menu {
|
||||
id: contextMenu
|
||||
|
||||
Platform.MenuItem {
|
||||
text: qsTr("Copy")
|
||||
enabled: resultText.selectedText.length > 0
|
||||
onTriggered: resultText.copy()
|
||||
}
|
||||
|
||||
Platform.MenuItem {
|
||||
text: qsTr("Select All")
|
||||
enabled: resultText.text.length > 0
|
||||
onTriggered: resultText.selectAll()
|
||||
}
|
||||
|
||||
Platform.MenuSeparator {}
|
||||
|
||||
Platform.MenuItem {
|
||||
text: root.expanded ? qsTr("Collapse") : qsTr("Expand")
|
||||
onTriggered: root.expanded = !root.expanded
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -45,8 +45,6 @@ TextEdit {
|
||||
onTriggered: root.copy()
|
||||
}
|
||||
|
||||
Platform.MenuSeparator {}
|
||||
|
||||
Platform.MenuItem {
|
||||
text: qsTr("Select All")
|
||||
enabled: root.text.length > 0
|
||||
|
||||
Reference in New Issue
Block a user