1/**
2 * \file IconButton.qml
3 * Tool button with an icon.
4 *
5 * \b Project: Kid3
6 * \author Urs Fleisch
7 * \date 9 Feb 2018
8 *
9 * Copyright (C) 2018  Urs Fleisch
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License as published by
13 * the Free Software Foundation; version 3.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 * GNU Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
22 */
23
24import QtQuick 2.11
25import QtQuick.Controls 2.4
26
27ToolButton {
28  property string iconName
29  property alias color: text.color
30
31  Text {
32    id: text
33    x: (parent.width - width) / 2
34    y: (parent.height - height) / 2
35    font.family: materialFont.name
36    font.pixelSize: 24
37    text: if (iconName) ({
38              "go-up": "^",
39              "go-down": "V",
40              "select": "S",
41              "clear": "X",
42              "go-previous": "<",
43              "go-next": ">",
44              "drawer": "=",
45              "navigation-menu": ":",
46              "edit": "/",
47              "add": "+",
48              "remove": "-"
49            })[iconName]
50  }
51}
52