import QtQuick 2.6 import QtQuick.Controls 2.1 import QtGraphicalEffects 1.0 import QtQuick.Controls.Material 2.3 Item { id: control height: 50 property bool showErrorBar: true RectangularGlow { id: toolBarEffect glowRadius: 3 spread: 0.2 color: "black" opacity: 0.3 anchors.fill: toolBar } Rectangle { id: toolBar color: "white" anchors.fill: parent Rectangle { id: errorField property int errorCode: app.errorCode onErrorCodeChanged: { if(!([-1, 200, 905].indexOf(app.errorCode) >= 0) && control.showErrorBar){ animateErrorBar.start() } } width: parent.width height: 0 anchors.top: parent.bottom color: app.getErrorInfo(errorCode)[0] > 0 ? app.getErrorInfo(errorCode)[0] > 1 ? "red":"grey" : "green" SequentialAnimation { id: animateErrorBar NumberAnimation { target: errorField property: "height" duration: 200 from: 0 to: 30 easing.type: Easing.InOutQuad } PauseAnimation { duration: 1300 } NumberAnimation { target: errorField property: "height" duration: 200 from: 30 to: 0 easing.type: Easing.InOutQuad } onRunningChanged: { if(!running){ app.errorCode = -1 } } } Label { id: errorText anchors.fill: parent color: "White" font.pixelSize: height * 0.5 verticalAlignment: Text.AlignVCenter horizontalAlignment: Text.AlignHCenter visible: parent.height !== 0 text: app.getErrorInfo(errorField.errorCode)[1] } } } }