Warning, /pim/kube/framework/qml/AbstractButton.qml is written in an unsupported language. File is not indexed.
0001 /*
0002 * Copyright (C) 2017 Michael Bohlender, <bohlender@kolabsys.com>
0003 * Copyright (C) 2017 Christian Mollekopf, <mollekopf@kolabsys.com>
0004 *
0005 * This program is free software; you can redistribute it and/or modify
0006 * it under the terms of the GNU General Public License as published by
0007 * the Free Software Foundation; either version 2 of the License, or
0008 * (at your option) any later version.
0009 *
0010 * This program is distributed in the hope that it will be useful,
0011 * but WITHOUT ANY WARRANTY; without even the implied warranty of
0012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0013 * GNU General Public License for more details.
0014 *
0015 * You should have received a copy of the GNU General Public License along
0016 * with this program; if not, write to the Free Software Foundation, Inc.,
0017 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
0018 */
0019
0020 import QtQuick 2.7
0021 import QtQuick.Templates 2.2 as T
0022 import org.kube.framework 1.0
0023
0024 T.Button {
0025 id: root
0026
0027 property color color: Colors.buttonColor
0028 property color textColor: Colors.textColor
0029 property alias backgroundOpacity: background.opacity
0030 property alias highlightColor: background.highlightColor
0031 property alias highlightOpacity: background.highlightOpacity
0032 property alias horizontalAlignment: label.horizontalAlignment
0033 property alias verticalAlignment: label.verticalAlignment
0034 property alias alert: background.alert
0035
0036 width: implicitWidth
0037 height: implicitHeight
0038
0039 implicitWidth: Math.max(Units.gridUnit, contentItem.implicitWidth + leftPadding + rightPadding)
0040 implicitHeight: Units.gridUnit + topPadding + bottomPadding
0041
0042 padding: Units.largeSpacing
0043 topPadding: Units.smallSpacing
0044 bottomPadding: Units.smallSpacing
0045
0046 clip: true
0047 hoverEnabled: true
0048 Keys.onReturnPressed: root.clicked()
0049
0050 background: DelegateBackground {
0051 id: background
0052 selected: root.checked
0053 focused: root.hovered || root.visualFocus
0054 color: root.color
0055
0056 Rectangle {
0057 anchors.fill: parent
0058 visible: root.pressed
0059 color: Colors.textColor
0060 opacity: 0.2
0061 }
0062 }
0063
0064 contentItem: Label {
0065 id: label
0066 text: root.text
0067 elide: Text.ElideRight
0068 horizontalAlignment: Text.AlignHCenter
0069 verticalAlignment: Text.AlignVCenter
0070 color: root.enabled ? root.textColor : Colors.disabledTextColor
0071 }
0072 }