summaryrefslogtreecommitdiff
path: root/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Sections/alert.qml
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Sections/alert.qml')
-rw-r--r--src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Sections/alert.qml68
1 files changed, 68 insertions, 0 deletions
diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Sections/alert.qml b/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Sections/alert.qml
new file mode 100644
index 0000000000..f19539b9be
--- /dev/null
+++ b/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Sections/alert.qml
@@ -0,0 +1,68 @@
+import QtQuick 2.0
+
+Item {
+ property alias text: alert_text.text
+ id: alert_item
+ opacity: 0
+
+ transitions: Transition {
+ NumberAnimation {
+ properties: "opacity"
+ }
+ }
+
+ function alert(message) {
+ text = message;
+ state = 'alerting';
+ alert_timer.start();
+ }
+
+ states: [
+ State {
+ name: 'alerting'
+ PropertyChanges {
+ target: alert_item
+ opacity: 1
+ }
+ }
+ ]
+
+ Timer {
+ id: alert_timer
+ running: false
+ interval: 4000
+ onTriggered: alert_item.state = '';
+ }
+
+
+ Rectangle {
+ id: background
+ anchors.fill: parent
+ color: "#000"
+ opacity: 0.8
+ }
+
+ Rectangle {
+ color: "#111"
+ width: 500
+ height: alert_text.height + 40
+ radius: 8
+ border.color: "#666"
+ border.width: 2
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.verticalCenter: parent.verticalCenter
+
+ Text {
+ id: alert_text
+ text: "This is a really really long long really really long longreally really long longreally really long longreally really long long alert"
+ color: "#fff"
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.verticalCenter: parent.verticalCenter
+ horizontalAlignment: Text.AlignHCenter
+ font.pixelSize: 24
+ width: parent.width
+ wrapMode: Text.WordWrap
+ }
+ }
+
+}