refactor: remove IconButton in favour of StatusRoundButton

This commit is contained in:
Pascal Precht 2020-11-16 15:04:40 +01:00 committed by Iuri Matias
parent 2aac433a3d
commit 6dabd361e1
3 changed files with 11 additions and 106 deletions

View File

@ -62,14 +62,13 @@ Item {
width: blockButton.width + blockButtonLabel.width + Style.current.padding
height: addButton.height
IconButton {
StatusRoundButton {
id: blockButton
clickable: false
anchors.verticalCenter: parent.verticalCenter
icon.name: "block-icon"
icon.color: Style.current.lightBlue
width: 40
height: 40
iconName: "block-icon"
color: Style.current.lightBlue
}
StyledText {

View File

@ -1,94 +0,0 @@
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
}
}

View File

@ -55,16 +55,16 @@ Item {
text: qsTrId("signing-phrase")
}
IconButton {
StatusRoundButton {
id: infoButton
clickable: false
anchors.left: labelSigningPhrase.right
anchors.leftMargin: 7
anchors.verticalCenter: parent.verticalCenter
width: 13
height: 13
iconName: "info"
color: Style.current.lightBlue
icon.width: width
icon.height: height
icon.name: "info"
StatusToolTip {
visible: infoButton.hovered
width: 337
@ -83,17 +83,17 @@ Item {
text: root.signingPhrase
}
IconButton {
StatusRoundButton {
id: passwordInfoButton
clickable: false
anchors.left: parent.left
anchors.leftMargin: 67
anchors.top: txtPassword.top
anchors.topMargin: 2
width: 13
height: 13
iconName: "info"
color: Style.current.lightBlue
icon.width: width
icon.height: height
icon.name: "info"
StatusToolTip {
visible: passwordInfoButton.hovered
width: 224