Warning, /libraries/kirigami-addons/src/formcard/private/SpinButton.qml is written in an unsupported language. File is not indexed.
0001 // Copyright 2023 Carl Schwan <carl@carlschwan.eu>
0002 // SPDX-License-Identifier: LGPL-2.0-or-later
0003
0004 import QtQuick 2.15
0005 import QtQuick.Controls 2.15 as QQC2
0006
0007 import org.kde.kirigami 2.19 as Kirigami
0008
0009 QQC2.Button {
0010 id: root
0011
0012 required property bool isEnd
0013 required property bool isStart
0014
0015 readonly property color borderColor: if (enabled && (visualFocus || hovered || down)) {
0016 return Kirigami.Theme.focusColor
0017 } else {
0018 return Kirigami.ColorUtils.linearInterpolation(Kirigami.Theme.backgroundColor, Kirigami.Theme.textColor, Kirigami.Theme.frameContrast)
0019 }
0020
0021 visible: Kirigami.Settings.isMobile
0022
0023 contentItem: Item {
0024 Kirigami.Icon {
0025 source: root.icon.name
0026 anchors.centerIn: parent
0027 implicitHeight: Kirigami.Units.iconSizes.small
0028 implicitWidth: Kirigami.Units.iconSizes.small
0029 }
0030 }
0031
0032 background: Kirigami.ShadowedRectangle {
0033 implicitWidth: implicitHeight
0034 implicitHeight: Kirigami.Units.gridUnit * 2
0035
0036 Kirigami.Theme.colorSet: Kirigami.Theme.Button
0037 color: root.down ? Kirigami.Theme.alternateBackgroundColor: Kirigami.Theme.backgroundColor
0038
0039 corners {
0040 topLeftRadius: (!root.mirrored && root.isStart) || (root.mirrored && root.isEnd) ? 4 : 0
0041 bottomLeftRadius: (!root.mirrored && root.isStart) || (root.mirrored && root.isEnd) ? 4 : 0
0042 topRightRadius: (!root.mirrored && root.isEnd) || (root.mirrored && root.isStart) ? 4 : 0
0043 bottomRightRadius: (!root.mirrored && root.isEnd) || (root.mirrored && root.isStart) ? 4 : 0
0044 }
0045
0046 border {
0047 width: 1
0048 color: root.borderColor
0049 }
0050 }
0051 }