status-desktop/ui/shared/IconButton.qml
Pascal Precht 0a9852758d
fix: from/to account not showing correctly
Fixes #1202

I had to revert the loader changes that switched from/to as it was causes quite a lot of logistical complexity. Instead of using Loaders, we are setting the type of account (account or contact), and it is being displayed appropriately. There is a very slight deviation from the design, however it is consistent with the design for other transaction previews.

feat: add BalanceValidator

Shows an exclamation icon next to the "from" account when the balance for the requested asset is too low.

This is useful when the user starts the transaction wizard on the TransactionPreview step.
2020-10-28 11:07:22 +01:00

95 lines
2.3 KiB
QML

import QtQuick 2.3
import QtQuick.Controls 2.3
import QtQuick.Layouts 1.3
import Qt.labs.platform 1.1
import "../imports"
RoundButton {
property int iconWidth: 14
property int iconHeight: 14
property alias iconImg: imgIcon
property bool clickable: true
property string iconName: "plusSign"
property color color: Style.current.blue
icon.width: iconWidth
icon.height: iconHeight
id: root
width: 36
height: 36
radius: width / 2
background: Rectangle {
color: parent.color
radius: parent.radius
}
Image {
id: imgIcon
fillMode: Image.PreserveAspectFit
source: "../app/img/" + parent.iconName + ".svg"
width: root.iconWidth
height: root.iconHeight
sourceSize.height: height * 2
sourceSize.width: width * 2
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
state: "default"
rotation: 0
states: [
State {
name: "default"
PropertyChanges {
target: imgIcon
rotation: 0
}
},
State {
name: "rotated"
PropertyChanges {
target: imgIcon
rotation: 45
}
}
]
transitions: [
Transition {
from: "default"
to: "rotated"
RotationAnimation {
duration: 150
direction: RotationAnimation.Clockwise
easing.type: Easing.InCubic
}
},
Transition {
from: "rotated"
to: "default"
RotationAnimation {
duration: 150
direction: RotationAnimation.Counterclockwise
easing.type: Easing.OutCubic
}
}
]
}
onClicked: {
if (root.clickable) {
imgIcon.state = "rotated"
}
}
MouseArea {
id: mouseArea
visible: root.clickable
anchors.fill: parent
onPressed: mouse.accepted = false
cursorShape: Qt.PointingHandCursor
}
}