Warning, /maui/mauikit/src/style.5/Button.qml is written in an unsupported language. File is not indexed.
0001 /*
0002 * Copyright 2017 Marco Martin <mart@kde.org>
0003 * Copyright 2017 The Qt Company Ltd.
0004 *
0005 * GNU Lesser General Public License Usage
0006 * Alternatively, this file may be used under the terms of the GNU Lesser
0007 * General Public License version 3 as published by the Free Software
0008 * Foundation and appearing in the file LICENSE.LGPLv3 included in the
0009 * packaging of this file. Please review the following information to
0010 * ensure the GNU Lesser General Public License version 3 requirements
0011 * will be met: https://www.gnu.org/licenses/lgpl.html.
0012 *
0013 * GNU General Public License Usage
0014 * Alternatively, this file may be used under the terms of the GNU
0015 * General Public License version 2.0 or later as published by the Free
0016 * Software Foundation and appearing in the file LICENSE.GPL included in
0017 * the packaging of this file. Please review the following information to
0018 * ensure the GNU General Public License version 2.0 requirements will be
0019 * met: http://www.gnu.org/licenses/gpl-2.0.html.
0020 */
0021
0022 import QtQuick 2.15
0023 import QtQuick.Templates 2.15 as T
0024 import org.mauikit.controls 1.3 as Maui
0025
0026 T.Button
0027 {
0028 id: control
0029 opacity: control.enabled ? 1 : 0.5
0030
0031 highlighted: activeFocus
0032
0033 implicitWidth: implicitContentWidth + leftPadding + rightPadding
0034
0035 implicitHeight: implicitContentHeight + topPadding + bottomPadding
0036
0037 hoverEnabled: !Maui.Handy.isMobile
0038
0039 Maui.Theme.colorSet: Maui.Theme.Button
0040 Maui.Theme.inherit: false
0041
0042 icon.width: Maui.Style.iconSize
0043 icon.height: Maui.Style.iconSize
0044
0045 icon.color: control.down || control.checked ? (control.flat ? Maui.Theme.highlightColor : Maui.Theme.highlightedTextColor) : Maui.Theme.textColor
0046
0047 padding: Maui.Style.defaultPadding
0048 spacing: Maui.Style.space.small
0049
0050 font: Maui.Style.defaultFont
0051
0052 focusPolicy: Qt.StrongFocus
0053 focus: true
0054
0055 Keys.enabled: true
0056
0057 Keys.onReturnPressed: { control.clicked() }
0058 Keys.onEnterPressed: { control.clicked() }
0059
0060 contentItem: Maui.IconLabel
0061 {
0062 text: control.text
0063 font: control.font
0064 icon: control.icon
0065 color: control.icon.color
0066 spacing: control.spacing
0067 display: control.display
0068 alignment: Qt.AlignHCenter
0069 }
0070
0071 background: Rectangle
0072 {
0073 visible: !control.flat
0074
0075 color: control.pressed || control.down || control.checked ? control.Maui.Theme.highlightColor : (control.highlighted || control.hovered ? control.Maui.Theme.hoverColor : Maui.Theme.backgroundColor)
0076
0077
0078 radius: Maui.Style.radiusV
0079
0080 Behavior on color
0081 {
0082 Maui.ColorTransition{}
0083 }
0084 }
0085 }