mirror of
https://github.com/monero-project/monero-gui.git
synced 2024-12-23 12:09:57 +00:00
Merge pull request #2448
d2b9d56
ContextMenu: styling, implement ContextMenuItem component (xiphon)
This commit is contained in:
commit
2f5c47e95f
3 changed files with 63 additions and 13 deletions
|
@ -1,6 +1,7 @@
|
||||||
import QtQuick.Controls 2.2
|
|
||||||
import QtQuick 2.9
|
import QtQuick 2.9
|
||||||
|
import QtQuick.Controls 2.2
|
||||||
|
|
||||||
|
import FontAwesome 1.0
|
||||||
import "../components" as MoneroComponents
|
import "../components" as MoneroComponents
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
|
@ -18,24 +19,20 @@ MouseArea {
|
||||||
id: contextMenu
|
id: contextMenu
|
||||||
|
|
||||||
background: Rectangle {
|
background: Rectangle {
|
||||||
|
border.color: MoneroComponents.Style.buttonBackgroundColorDisabledHover
|
||||||
|
border.width: 1
|
||||||
radius: 2
|
radius: 2
|
||||||
color: MoneroComponents.Style.buttonInlineBackgroundColor
|
color: MoneroComponents.Style.buttonBackgroundColorDisabled
|
||||||
}
|
}
|
||||||
|
|
||||||
font.family: MoneroComponents.Style.fontRegular.name
|
padding: 1
|
||||||
font.pixelSize: 14
|
width: 100
|
||||||
width: 50
|
|
||||||
x: root.mouseX
|
x: root.mouseX
|
||||||
y: root.mouseY
|
y: root.mouseY
|
||||||
|
|
||||||
MenuItem {
|
MoneroComponents.ContextMenuItem {
|
||||||
id: pasteItem
|
enabled: root.parent.canPaste === true
|
||||||
background: Rectangle {
|
glyphIcon: FontAwesome.paste
|
||||||
radius: 2
|
|
||||||
color: MoneroComponents.Style.buttonBackgroundColorDisabledHover
|
|
||||||
opacity: pasteItem.down ? 1 : 0
|
|
||||||
}
|
|
||||||
enabled: root.parent.canPaste
|
|
||||||
onTriggered: root.paste()
|
onTriggered: root.paste()
|
||||||
text: qsTr("Paste") + translationManager.emptyString
|
text: qsTr("Paste") + translationManager.emptyString
|
||||||
}
|
}
|
||||||
|
|
52
components/ContextMenuItem.qml
Normal file
52
components/ContextMenuItem.qml
Normal file
|
@ -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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
1
qml.qrc
1
qml.qrc
|
@ -23,6 +23,7 @@
|
||||||
<file>pages/AddressBook.qml</file>
|
<file>pages/AddressBook.qml</file>
|
||||||
<file>pages/Mining.qml</file>
|
<file>pages/Mining.qml</file>
|
||||||
<file>components/ContextMenu.qml</file>
|
<file>components/ContextMenu.qml</file>
|
||||||
|
<file>components/ContextMenuItem.qml</file>
|
||||||
<file>components/NetworkStatusItem.qml</file>
|
<file>components/NetworkStatusItem.qml</file>
|
||||||
<file>components/Input.qml</file>
|
<file>components/Input.qml</file>
|
||||||
<file>components/StandardButton.qml</file>
|
<file>components/StandardButton.qml</file>
|
||||||
|
|
Loading…
Reference in a new issue