AusweisApp2/resources/qml/TextCircle.qml
2017-07-03 09:30:10 +02:00

68 lines
1.4 KiB
QML

import QtQuick 2.5
import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4
import "global"
Item {
property alias text: t.text
height: Utils.dp(50)
width: height
BusyIndicator {
id: busy
anchors.centerIn: parent
height: rec.height * 1.1
width: height
running: false
style: NpaBusyIndicatorStyle {}
}
Rectangle {
id: rec
border.width: 1
border.color: Constants.blue
color: parent.state === "active" ? Constants.blue : "white"
height: parent.state === "active" ? parent.height : parent.height / 2
width: height
radius: width * 0.5
anchors.centerIn: parent
}
Text {
id: t
anchors.centerIn: rec
font.bold: parent.state === "active"
font.pixelSize: rec.height / 3
color: parent.state === "active" ? "white" : Constants.blue
}
state:"inactive"
states: [
State { name: "active" },
State { name: "inactive" }
]
transitions: [
Transition {
from: "inactive"
to: "active"
SequentialAnimation {
ParallelAnimation {
NumberAnimation {target: t; property: "font.pixelSize"; duration: 1000; easing.type: Easing.OutElastic}
ColorAnimation {duration: 100}
}
PropertyAnimation {target: busy; property: "running"; to: true}
}
},
Transition {
from: "active"
to: "inactive"
SequentialAnimation {
PropertyAction {target: busy; property: "running"; value: false}
NumberAnimation {target: t; property: "font.pixelSize"; duration: 200}
}
}
]
}