From 74e12ce71d00e7e9aea43a985e8a9dbfc4ad0844 Mon Sep 17 00:00:00 2001 From: xiphon Date: Fri, 8 Nov 2019 00:56:10 +0000 Subject: ContextMenu: implement 'paste' context menu for all text fields --- components/ContextMenu.qml | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 components/ContextMenu.qml (limited to 'components/ContextMenu.qml') 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 + } + } +} -- cgit v1.2.3