aboutsummaryrefslogtreecommitdiff
path: root/components/ContextMenu.qml
diff options
context:
space:
mode:
authorxiphon <xiphon@protonmail.com>2019-11-08 00:56:10 +0000
committerxiphon <xiphon@protonmail.com>2019-11-08 12:41:32 +0000
commit74e12ce71d00e7e9aea43a985e8a9dbfc4ad0844 (patch)
tree917f48165df3aabf85a1e82211f6ad1668213c18 /components/ContextMenu.qml
parent7f7a39292c57f9b51090005d8a8e39297d988e0b (diff)
downloadmonzero-gui-74e12ce71d00e7e9aea43a985e8a9dbfc4ad0844.tar.gz
monzero-gui-74e12ce71d00e7e9aea43a985e8a9dbfc4ad0844.tar.xz
monzero-gui-74e12ce71d00e7e9aea43a985e8a9dbfc4ad0844.zip
ContextMenu: implement 'paste' context menu for all text fields
Diffstat (limited to 'components/ContextMenu.qml')
-rw-r--r--components/ContextMenu.qml43
1 files changed, 43 insertions, 0 deletions
diff --git a/components/ContextMenu.qml b/components/ContextMenu.qml
new file mode 100644
index 00000000..58442e8d
--- /dev/null
+++ b/components/ContextMenu.qml
@@ -0,0 +1,43 @@
+import QtQuick.Controls 2.2
+import QtQuick 2.9
+
+import "../components" as MoneroComponents
+
+MouseArea {
+ signal paste()
+
+ id: root
+ acceptedButtons: Qt.RightButton
+ anchors.fill: parent
+ onClicked: {
+ if (mouse.button === Qt.RightButton)
+ contextMenu.open()
+ }
+
+ Menu {
+ id: contextMenu
+
+ background: Rectangle {
+ radius: 2
+ color: MoneroComponents.Style.buttonInlineBackgroundColor
+ }
+
+ font.family: MoneroComponents.Style.fontRegular.name
+ font.pixelSize: 14
+ width: 50
+ x: root.mouseX
+ y: root.mouseY
+
+ MenuItem {
+ id: pasteItem
+ background: Rectangle {
+ radius: 2
+ color: MoneroComponents.Style.buttonBackgroundColorDisabledHover
+ opacity: pasteItem.down ? 1 : 0
+ }
+ enabled: root.parent.canPaste
+ onTriggered: root.paste()
+ text: qsTr("Paste") + translationManager.emptyString
+ }
+ }
+}