Warning, /education/gcompris/src/core/ReadyButton.qml is written in an unsupported language. File is not indexed.
0001 /* GCompris - ReadyButton.qml 0002 * 0003 * SPDX-FileCopyrightText: 2014 Bruno Coudoin <bruno.coudoin@gcompris.net> 0004 * 0005 * Authors: 0006 * Bruno Coudoin <bruno.coudoin@gcompris.net> 0007 * 0008 * SPDX-License-Identifier: GPL-3.0-or-later 0009 */ 0010 import QtQuick 2.12 0011 import GCompris 1.0 0012 0013 Rectangle { 0014 id: iAmReady 0015 0016 /** 0017 * type: var 0018 * Existing themes for the button. 0019 * A theme is composed of: 0020 * The button's border color 0021 * The text color 0022 */ 0023 property var themes: { 0024 "dark": { 0025 borderColor: "#373737", 0026 fillColor: "#FFFFFF", 0027 textColor: "#373737" 0028 }, 0029 "light": { 0030 borderColor: "white", 0031 fillColor: "#373737", 0032 textColor: "white" 0033 } 0034 } 0035 0036 /** 0037 * type: string 0038 * Defines the theme of the ReadyButton - dark or light. 0039 * 0040 * Default theme is dark. 0041 */ 0042 property string theme: "dark" 0043 0044 /** 0045 * Emitted when the ReadyButton is clicked 0046 */ 0047 signal clicked 0048 0049 anchors.horizontalCenter: parent.horizontalCenter 0050 anchors.verticalCenter: parent.verticalCenter 0051 border.color: themes[theme].borderColor 0052 visible: true 0053 radius: 10 0054 smooth: true 0055 border.width: 4 0056 width: iAmReadyText.width + 50 * ApplicationInfo.ratio 0057 height: iAmReadyText.height + 50 * ApplicationInfo.ratio 0058 color: themes[theme].fillColor 0059 0060 GCText { 0061 id: iAmReadyText 0062 color: themes[theme].textColor 0063 anchors.horizontalCenter: parent.horizontalCenter 0064 anchors.verticalCenter: parent.verticalCenter 0065 font.bold: true 0066 fontSize: mediumSize 0067 text: qsTr("I am Ready") 0068 visible: iAmReady.visible 0069 } 0070 0071 MouseArea { 0072 id: mouseArea 0073 anchors.fill: parent 0074 hoverEnabled: true 0075 0076 onClicked: { 0077 iAmReady.visible = false 0078 iAmReady.clicked() 0079 } 0080 } 0081 0082 states: [ 0083 State { 0084 name: "notClicked" 0085 PropertyChanges { 0086 target: iAmReady 0087 scale: 1.0 0088 } 0089 }, 0090 State { 0091 name: "clicked" 0092 when: mouseArea.pressed 0093 PropertyChanges { 0094 target: iAmReady 0095 scale: 0.9 0096 } 0097 }, 0098 State { 0099 name: "hover" 0100 when: mouseArea.containsMouse 0101 PropertyChanges { 0102 target: iAmReady 0103 scale: 1.1 0104 } 0105 } 0106 ] 0107 0108 Behavior on scale { NumberAnimation { duration: 70 } } 0109 }