Warning, /education/gcompris/src/activities/color_mix/ColorButton.qml is written in an unsupported language. File is not indexed.
0001 /* GCompris - ColorButton.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
0012 import "../../core"
0013
0014 Item {
0015 id: button
0016 height: parent.height / 4
0017 width: height
0018 z: 3
0019
0020 property alias source: buttonImage.source
0021
0022 signal clicked
0023
0024 Image {
0025 id: buttonImage
0026 anchors.centerIn: parent
0027 sourceSize.width: parent.width
0028 horizontalAlignment: Text.AlignHCenter
0029 verticalAlignment: Text.AlignVCenter
0030 }
0031
0032 MouseArea {
0033 id: mouseArea
0034 anchors.centerIn: parent
0035 enabled: !items.buttonsBlocked
0036 height: 2.3 * parent.height
0037 width: 2.3 * parent.width
0038 hoverEnabled: true
0039
0040 onClicked: button.clicked()
0041 }
0042
0043 states: [
0044 State {
0045 name: "notclicked"
0046 PropertyChanges {
0047 target: button
0048 scale: 1.0
0049 }
0050 },
0051 State {
0052 name: "clicked"
0053 when: mouseArea.pressed
0054 PropertyChanges {
0055 target: button
0056 scale: 0.9
0057 }
0058 },
0059 State {
0060 name: "hover"
0061 when: mouseArea.containsMouse
0062 PropertyChanges {
0063 target: button
0064 scale: 1.1
0065 }
0066 }
0067 ]
0068
0069 Behavior on scale { NumberAnimation { duration: 70 } }
0070 }