Warning, /education/gcompris/src/core/BarButton.qml is written in an unsupported language. File is not indexed.
0001 /* GCompris - BarButton.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 /** 0014 * Helper QML component for a button shown on the Bar. 0015 * @ingroup components 0016 * 0017 * Used internally by the Bar component. 0018 * 0019 * @sa Bar 0020 */ 0021 Image { 0022 id: button 0023 state: "notclicked" 0024 0025 property alias mouseArea: mouseArea 0026 0027 signal clicked 0028 0029 MouseArea { 0030 id: mouseArea 0031 anchors.fill: parent 0032 hoverEnabled: true 0033 onClicked: button.clicked() 0034 } 0035 0036 states: [ 0037 State { 0038 name: "reset" 0039 when: !mouseArea.enabled 0040 PropertyChanges { 0041 target: button 0042 scale: 1.0 0043 } 0044 }, 0045 State { 0046 name: "notclicked" 0047 PropertyChanges { 0048 target: button 0049 scale: 1.0 0050 } 0051 }, 0052 State { 0053 name: "clicked" 0054 when: mouseArea.pressed 0055 PropertyChanges { 0056 target: button 0057 scale: 0.9 0058 } 0059 }, 0060 State { 0061 name: "hover" 0062 when: mouseArea.containsMouse 0063 PropertyChanges { 0064 target: button 0065 scale: 1.1 0066 } 0067 } 0068 ] 0069 0070 Behavior on scale { NumberAnimation { duration: 70 } } 0071 Behavior on opacity { PropertyAnimation { duration: 200 } } 0072 0073 }