Warning, /education/gcompris/src/core/IntroButton.qml is written in an unsupported language. File is not indexed.

0001 /* GCompris - IntroButton.qml
0002  *
0003  * SPDX-FileCopyrightText: 2018 Johnny Jazeix <jazeix@gmail.com>
0004  *
0005  * Authors:
0006  *   Johnny Jazeix <jazeix@gmail.com>
0007  *
0008  *   SPDX-License-Identifier: GPL-3.0-or-later
0009  */
0010 
0011 /*
0012  * A generic QML button for intro/tutorial in GCompris.
0013  * Can probably be used at some other places.
0014  */
0015 
0016 import QtQuick 2.12
0017 
0018 Rectangle {
0019     id: button
0020     color: "#d8ffffff"
0021     border.color: "#2a2a2a"
0022     border.width: 3
0023     radius: 8
0024 
0025     property alias text: buttonText.text
0026 
0027     signal clicked
0028 
0029     GCText {
0030         id: buttonText
0031         width: parent.width
0032         height: parent.height
0033         horizontalAlignment: Text.AlignHCenter
0034         verticalAlignment: Text.AlignVCenter
0035         wrapMode: Text.WordWrap
0036         fontSizeMode: Text.Fit
0037     }
0038 
0039     MouseArea {
0040         id: buttonArea
0041         anchors.fill: parent
0042         onClicked: parent.clicked()
0043     }
0044     states: [
0045     State {
0046         name: "notclicked"
0047         PropertyChanges {
0048             target: button
0049             scale: 1.0
0050         }
0051     },
0052     State {
0053         name: "clicked"
0054         when: buttonArea.pressed
0055         PropertyChanges {
0056             target: button
0057             scale: 0.9
0058         }
0059     },
0060     State {
0061         name: "hover"
0062         when: buttonArea.containsMouse
0063         PropertyChanges {
0064             target: button
0065             scale: 1.1
0066         }
0067     }
0068     ]
0069     Behavior on scale { NumberAnimation { duration: 70 } }
0070 }