fix: fixed context menu (#29)

This commit is contained in:
vkamn
2025-09-02 15:01:07 +08:00
committed by GitHub
parent fc6bd027c3
commit f49465674c
3 changed files with 36 additions and 0 deletions

View File

@@ -239,6 +239,7 @@
<file>ui/qml/Pages2/PageSettingsApiDevices.qml</file>
<file>images/controls/monitor.svg</file>
<file>ui/qml/DefaultVpn/Controls/DropDownType.qml</file>
<file>ui/qml/DefaultVpn/Controls/ContextMenuType.qml</file>
<file>ui/qml/DefaultVpn/main.qml</file>
<file>ui/qml/DefaultVpn/Pages/PageHome.qml</file>
<file>ui/qml/DefaultVpn/Pages/PageSettings.qml</file>

View File

@@ -0,0 +1,31 @@
import QtQuick
import QtQuick.Controls
Menu {
property var textObj
popupType: Popup.Native
MenuItem {
text: qsTr("C&ut")
enabled: textObj.selectedText
onTriggered: textObj.cut()
}
MenuItem {
text: qsTr("&Copy")
enabled: textObj.selectedText
onTriggered: textObj.copy()
}
MenuItem {
text: qsTr("&Paste")
// Fix calling paste from clipboard when launching app on android
enabled: Qt.platform.os === "android" ? true : textObj.canPaste
onTriggered: textObj.paste()
}
MenuItem {
text: qsTr("&SelectAll")
enabled: textObj.length > 0
onTriggered: textObj.selectAll()
}
}

View File

@@ -35,6 +35,10 @@ TextField {
radius: 6
}
ContextMenu.menu: ContextMenuType {
textObj: root
}
topPadding: 12
bottomPadding: 12
leftPadding: 16