/* GCompris - BarButton.qml * * Copyright (C) 2014 Bruno Coudoin * * Authors: * Bruno Coudoin * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, see . */ import QtQuick 2.6 import GCompris 1.0 /** * Helper QML component for a button shown on the Bar. * @ingroup components * * Used internally by the Bar component. * * @sa Bar */ Image { id: button state: "notclicked" property alias mouseArea: mouseArea signal clicked MouseArea { id: mouseArea anchors.fill: parent hoverEnabled: true onClicked: button.clicked() } states: [ State { name: "notclicked" PropertyChanges { target: button scale: 1.0 } }, State { name: "clicked" when: mouseArea.pressed PropertyChanges { target: button scale: 0.9 } }, State { name: "hover" when: mouseArea.containsMouse PropertyChanges { target: button scale: 1.1 } } ] Behavior on scale { NumberAnimation { duration: 70 } } Behavior on opacity { PropertyAnimation { duration: 200 } } }