aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorluigi1111 <luigi1111w@gmail.com>2019-11-19 10:36:34 -0600
committerluigi1111 <luigi1111w@gmail.com>2019-11-19 10:36:34 -0600
commit2f5c47e95fab6beec40e8c1dec7b74c75b931a0c (patch)
treef68bbdb63c49350e88e5ed3fdfbfe345256592e9
parent34b216e6dc6cb964e49654187ec656eb43b1441b (diff)
parentd2b9d5690ba7eef47f9ac27d960a0fa932aa40c5 (diff)
downloadmonzero-gui-2f5c47e95fab6beec40e8c1dec7b74c75b931a0c.tar.gz
monzero-gui-2f5c47e95fab6beec40e8c1dec7b74c75b931a0c.tar.xz
monzero-gui-2f5c47e95fab6beec40e8c1dec7b74c75b931a0c.zip
Merge pull request #2448
d2b9d56 ContextMenu: styling, implement ContextMenuItem component (xiphon)
-rw-r--r--components/ContextMenu.qml23
-rw-r--r--components/ContextMenuItem.qml52
-rw-r--r--qml.qrc1
3 files changed, 63 insertions, 13 deletions
diff --git a/components/ContextMenu.qml b/components/ContextMenu.qml
index 58442e8d..a4ca3209 100644
--- a/components/ContextMenu.qml
+++ b/components/ContextMenu.qml
@@ -1,6 +1,7 @@
-import QtQuick.Controls 2.2
import QtQuick 2.9
+import QtQuick.Controls 2.2
+import FontAwesome 1.0
import "../components" as MoneroComponents
MouseArea {
@@ -18,24 +19,20 @@ MouseArea {
id: contextMenu
background: Rectangle {
+ border.color: MoneroComponents.Style.buttonBackgroundColorDisabledHover
+ border.width: 1
radius: 2
- color: MoneroComponents.Style.buttonInlineBackgroundColor
+ color: MoneroComponents.Style.buttonBackgroundColorDisabled
}
- font.family: MoneroComponents.Style.fontRegular.name
- font.pixelSize: 14
- width: 50
+ padding: 1
+ width: 100
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
+ MoneroComponents.ContextMenuItem {
+ enabled: root.parent.canPaste === true
+ glyphIcon: FontAwesome.paste
onTriggered: root.paste()
text: qsTr("Paste") + translationManager.emptyString
}
diff --git a/components/ContextMenuItem.qml b/components/ContextMenuItem.qml
new file mode 100644
index 00000000..de2d54ad
--- /dev/null
+++ b/components/ContextMenuItem.qml
@@ -0,0 +1,52 @@
+import QtQuick 2.9
+import QtQuick.Controls 2.2
+import QtQuick.Layouts 1.1
+
+import FontAwesome 1.0
+import "../components" as MoneroComponents
+
+MenuItem {
+ id: menuItem
+
+ property bool glyphIconSolid: true
+ property alias glyphIcon: glyphIcon.text
+
+ background: Rectangle {
+ color: MoneroComponents.Style.buttonBackgroundColorDisabledHover
+ opacity: mouse.containsMouse ? 1 : 0
+
+ MouseArea {
+ id: mouse
+
+ anchors.fill: parent
+ hoverEnabled: true
+ onClicked: menuItem.triggered()
+ visible: menuItem.enabled
+ }
+ }
+
+ contentItem: RowLayout {
+ anchors.fill: parent
+ anchors.leftMargin: 10
+ anchors.rightMargin: 10
+ opacity: menuItem.enabled ? 1 : 0.4
+ spacing: 8
+
+ Text {
+ id: glyphIcon
+
+ color: MoneroComponents.Style.buttonTextColor
+ font.family: glyphIconSolid ? FontAwesome.fontFamilySolid : FontAwesome.fontFamily
+ font.pixelSize: 14
+ font.styleName: glyphIconSolid ? "Solid" : "Regular"
+ }
+
+ Text {
+ color: MoneroComponents.Style.buttonTextColor
+ font.family: MoneroComponents.Style.fontRegular.name
+ font.pixelSize: 14
+ Layout.fillWidth: true
+ text: menuItem.text
+ }
+ }
+}
diff --git a/qml.qrc b/qml.qrc
index 590eccb6..1ad92107 100644
--- a/qml.qrc
+++ b/qml.qrc
@@ -23,6 +23,7 @@
<file>pages/AddressBook.qml</file>
<file>pages/Mining.qml</file>
<file>components/ContextMenu.qml</file>
+ <file>components/ContextMenuItem.qml</file>
<file>components/NetworkStatusItem.qml</file>
<file>components/Input.qml</file>
<file>components/StandardButton.qml</file>