Merge pull request #2950

d18af7d LeftPanel: simpifly color binding (selsta)
This commit is contained in:
luigi1111 2020-06-19 16:14:31 -05:00
commit 6a3e1aaf40
No known key found for this signature in database
GPG key ID: F4ACA0183641E010

View file

@ -263,6 +263,10 @@ Rectangle {
anchors.leftMargin: 58 anchors.leftMargin: 58
anchors.baseline: currencyLabel.baseline anchors.baseline: currencyLabel.baseline
color: MoneroComponents.Style.blackTheme ? "white" : "black" color: MoneroComponents.Style.blackTheme ? "white" : "black"
Binding on color {
when: balancePart1MouseArea.containsMouse || balancePart2MouseArea.containsMouse
value: MoneroComponents.Style.orange
}
text: { text: {
if (persistentSettings.fiatPriceEnabled && persistentSettings.fiatPriceToggle) { if (persistentSettings.fiatPriceEnabled && persistentSettings.fiatPriceToggle) {
return balanceFiatString.split('.')[0] + "." return balanceFiatString.split('.')[0] + "."
@ -284,14 +288,6 @@ Rectangle {
hoverEnabled: true hoverEnabled: true
anchors.fill: parent anchors.fill: parent
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
onEntered: {
balancePart1.color = MoneroComponents.Style.orange
balancePart2.color = MoneroComponents.Style.orange
}
onExited: {
balancePart1.color = Qt.binding(function() { return MoneroComponents.Style.blackTheme ? "white" : "black" })
balancePart2.color = Qt.binding(function() { return MoneroComponents.Style.blackTheme ? "white" : "black" })
}
onClicked: { onClicked: {
console.log("Copied to clipboard"); console.log("Copied to clipboard");
clipboard.setText(balancePart1.text + balancePart2.text); clipboard.setText(balancePart1.text + balancePart2.text);
@ -305,7 +301,7 @@ Rectangle {
anchors.left: balancePart1.right anchors.left: balancePart1.right
anchors.leftMargin: 2 anchors.leftMargin: 2
anchors.baseline: currencyLabel.baseline anchors.baseline: currencyLabel.baseline
color: MoneroComponents.Style.blackTheme ? "white" : "black" color: balancePart1.color
text: { text: {
if (persistentSettings.fiatPriceEnabled && persistentSettings.fiatPriceToggle) { if (persistentSettings.fiatPriceEnabled && persistentSettings.fiatPriceToggle) {
return balanceFiatString.split('.')[1] return balanceFiatString.split('.')[1]
@ -315,11 +311,10 @@ Rectangle {
} }
font.pixelSize: 16 font.pixelSize: 16
MouseArea { MouseArea {
id: balancePart2MouseArea
hoverEnabled: true hoverEnabled: true
anchors.fill: parent anchors.fill: parent
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
onEntered: balancePart1MouseArea.entered()
onExited: balancePart1MouseArea.exited()
onClicked: balancePart1MouseArea.clicked(mouse) onClicked: balancePart1MouseArea.clicked(mouse)
} }
} }