added animation to error field
This commit is contained in:
parent
c1e0f29979
commit
836afb0a30
1 changed files with 49 additions and 3 deletions
|
@ -3,18 +3,40 @@ import QtQuick.Controls 2.1
|
||||||
import QtQuick.Controls.Material 2.1
|
import QtQuick.Controls.Material 2.1
|
||||||
|
|
||||||
ToolBar {
|
ToolBar {
|
||||||
|
id: toolBar
|
||||||
property bool showErrorBar: true
|
property bool showErrorBar: true
|
||||||
Material.theme: Material.Light
|
Material.theme: Material.Light
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: errorField
|
id: errorField
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: 30
|
height: 30
|
||||||
visible: window.is_error & stackView.currentItem.objectName !== "LoginPage" & showErrorBar
|
enabled: window.is_error & stackView.currentItem.objectName !== "LoginPage" & showErrorBar
|
||||||
anchors.top: parent.bottom
|
anchors.top: parent.bottom
|
||||||
|
|
||||||
color: "red"
|
color: "red"
|
||||||
|
onEnabledChanged: {
|
||||||
|
if(enabled){
|
||||||
|
toolBar.state = 'moveIn'
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
toolBar.state = 'moveOut'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
MouseArea { anchors.fill: parent; onClicked: {
|
||||||
|
toolBar.state = 'moveOut'
|
||||||
|
|
||||||
|
console.log("clicked")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors {
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
top: parent.top
|
||||||
|
horizontalCenter: parent.horizontalCenter
|
||||||
|
topMargin: ( parent.height / 2 ) - ( height / 2 )
|
||||||
|
}
|
||||||
|
|
||||||
id: errorText
|
id: errorText
|
||||||
font.family: "Helvetica"
|
font.family: "Helvetica"
|
||||||
color: "White"
|
color: "White"
|
||||||
|
@ -23,4 +45,28 @@ ToolBar {
|
||||||
text: window.error
|
text: window.error
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
states: [
|
||||||
|
State {
|
||||||
|
name: "moveOut"
|
||||||
|
PropertyChanges { target: errorField; height: 0 }
|
||||||
|
PropertyChanges { target: errorText; height: 0 }
|
||||||
|
},
|
||||||
|
State {
|
||||||
|
name: "moveIn"
|
||||||
|
PropertyChanges { target: errorField; height: 30 }
|
||||||
|
PropertyChanges { target: errorText; height: 0 }
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
transitions: [
|
||||||
|
Transition {
|
||||||
|
to: "moveOut"
|
||||||
|
NumberAnimation { properties: "height"; easing.type: Easing.InOutQuad; duration: 200 }
|
||||||
|
},
|
||||||
|
Transition {
|
||||||
|
to: "moveIn"
|
||||||
|
NumberAnimation { properties: "height"; easing.type: Easing.InOutQuad; duration: 200 }
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue