Debian Codegraph @

qml/components/IconButton.qml

raw
1 /*
2 * Copyright 2014 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17 import QtQuick 2.12
18 import Lomiri.Components 1.3
19
20 AbstractButton {
21 id: button
22
23 property string iconName
24 property alias iconColor: icon.color
25
26 width: units.gu(5)
27 height: width
28
29 Rectangle {
30 anchors.fill: parent
31 color: Qt.rgba(1.0, 1.0, 1.0, 0.3)
32 visible: button.pressed
33 }
34
35 Icon {
36 id: icon
37 anchors.centerIn: parent
38 width: units.gu(2.5)
39 height: width
40 color: "white"
41 name: action ? action.iconName : button.iconName
42 opacity: action ? (action.enabled ? 1.0 : 0.5) : 1.0
43 asynchronous: true
44 }
45 }