feat: Add open link to text block context menu

This commit is contained in:
Petr Mironychev
2025-11-12 19:18:21 +01:00
parent 4956d6ab7d
commit 1cd19aa5d1

View File

@ -33,12 +33,22 @@ TextEdit {
anchors.fill: parent anchors.fill: parent
acceptedButtons: Qt.RightButton acceptedButtons: Qt.RightButton
onClicked: contextMenu.open() onClicked: contextMenu.open()
propagateComposedEvents: true cursorShape: parent.hoveredLink ? Qt.PointingHandCursor : Qt.IBeamCursor
} }
Platform.Menu { Platform.Menu {
id: contextMenu id: contextMenu
Platform.MenuItem {
text: qsTr("Open Link")
visible: root.hoveredLink.length > 0
onTriggered: Qt.openUrlExternally(root.hoveredLink)
}
Platform.MenuSeparator {
visible: root.hoveredLink.length > 0
}
Platform.MenuItem { Platform.MenuItem {
text: qsTr("Copy") text: qsTr("Copy")
enabled: root.selectedText.length > 0 enabled: root.selectedText.length > 0