Warning, /education/gcompris/src/activities/piano_composition/SwitchableOptions.qml is written in an unsupported language. File is not indexed.
0001 /* GCompris - SwitchableOptions.qml 0002 * 0003 * SPDX-FileCopyrightText: 2018 Aman Kumar Gupta <gupta2140@gmail.com> 0004 * 0005 * Authors: 0006 * Beth Hadley <bethmhadley@gmail.com> (GTK+ version) 0007 * Johnny Jazeix <jazeix@gmail.com> (Qt Quick port) 0008 * Aman Kumar Gupta <gupta2140@gmail.com> (Qt Quick port) 0009 * Timothée Giet <animtim@gmail.com> (refactoring) 0010 * 0011 * SPDX-License-Identifier: GPL-3.0-or-later 0012 */ 0013 import QtQuick 2.12 0014 import GCompris 1.0 0015 0016 import "../../core" 0017 0018 Image { 0019 id: switchableOptions 0020 0021 property int currentIndex: 0 0022 property int nbOptions: 1 0023 0024 signal clicked 0025 0026 sourceSize.width: optionsRow.iconsWidth 0027 0028 MouseArea { 0029 id: mouseArea 0030 anchors.fill: parent 0031 hoverEnabled: true 0032 onClicked: { 0033 parent.currentIndex = (parent.currentIndex + 1) % nbOptions 0034 //clickAnimation.start() 0035 parent.clicked() 0036 } 0037 } 0038 0039 states: [ 0040 State { 0041 name: "notclicked" 0042 PropertyChanges { 0043 target: switchableOptions 0044 scale: 1.0 0045 } 0046 }, 0047 State { 0048 name: "clicked" 0049 when: mouseArea.pressed 0050 PropertyChanges { 0051 target: switchableOptions 0052 scale: 0.9 0053 } 0054 }, 0055 State { 0056 name: "hover" 0057 when: mouseArea.containsMouse 0058 PropertyChanges { 0059 target: switchableOptions 0060 scale: 1.1 0061 } 0062 } 0063 ] 0064 0065 Behavior on scale { NumberAnimation { duration: 70 } } 0066 Behavior on opacity { PropertyAnimation { duration: 200 } } 0067 }