Warning, /education/gcompris/src/activities/gnumch-equality/WarnMonster.qml is written in an unsupported language. File is not indexed.

0001 /* GCompris - WarnMonster.qml
0002 *
0003 * SPDX-FileCopyrightText: 2014 Manuel Tondeur <manueltondeur@gmail.com>
0004 *
0005 * Authors:
0006 *   Joe Neeman (spuzzzzzzz@gmail.com) (GTK+ version)
0007 *   Manuel Tondeur <manueltondeur@gmail.com> (Qt Quick port)
0008 *
0009 *   SPDX-License-Identifier: GPL-3.0-or-later
0010 */
0011 import QtQuick 2.12
0012 import GCompris 1.0
0013 
0014 import "../../core"
0015 
0016 Rectangle {
0017     property alias text: warningText
0018 
0019     signal stop
0020 
0021     Component.onCompleted: {
0022         activity.stop.connect(stop);
0023     }
0024 
0025     onStop: {
0026         timerWarn.stop();
0027     }
0028 
0029     width: warningText.contentWidth * 1.1
0030     height: warningText.height * 1.1
0031     opacity: 0
0032     border.width: 2
0033     border.color: "#373737"
0034     radius: 5
0035 
0036     anchors.horizontalCenter: topPanel.horizontalCenter
0037     anchors.verticalCenter: topPanel.verticalCenter
0038 
0039     GCText {
0040         id: warningText
0041         text: qsTr("Be careful, a troggle!")
0042         fontSize: largeSize
0043         wrapMode: Text.WordWrap
0044         horizontalAlignment: Text.AlignHCenter
0045         anchors.horizontalCenter: parent.horizontalCenter
0046         color: "red"
0047     }
0048 
0049     onOpacityChanged: timerWarn.start()
0050 
0051     Timer {
0052         id: timerWarn
0053         interval: 2500
0054 
0055         onTriggered: parent.opacity = 0
0056     }
0057 
0058     Behavior on opacity {
0059         NumberAnimation {
0060             duration: 500
0061         }
0062     }
0063 }