mirror of
https://github.com/Palm1r/QodeAssist.git
synced 2026-02-14 19:13:12 -05:00
feat: Improve context menu for tool results in chat
This commit is contained in:
@ -18,6 +18,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import QtQuick
|
import QtQuick
|
||||||
|
import Qt.labs.platform as Platform
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: root
|
id: root
|
||||||
@ -83,15 +84,47 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
spacing: 8
|
spacing: 8
|
||||||
|
|
||||||
Text {
|
TextEdit {
|
||||||
id: resultText
|
id: resultText
|
||||||
|
|
||||||
width: parent.width
|
|
||||||
text: root.toolResult
|
text: root.toolResult
|
||||||
wrapMode: Text.Wrap
|
readOnly: true
|
||||||
|
selectByMouse: true
|
||||||
|
color: palette.text
|
||||||
|
wrapMode: Text.WordWrap
|
||||||
font.family: "monospace"
|
font.family: "monospace"
|
||||||
font.pixelSize: 11
|
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()
|
onTriggered: root.copy()
|
||||||
}
|
}
|
||||||
|
|
||||||
Platform.MenuSeparator {}
|
|
||||||
|
|
||||||
Platform.MenuItem {
|
Platform.MenuItem {
|
||||||
text: qsTr("Select All")
|
text: qsTr("Select All")
|
||||||
enabled: root.text.length > 0
|
enabled: root.text.length > 0
|
||||||
|
|||||||
Reference in New Issue
Block a user