Kirigami-addons

SpinButton.qml
1// Copyright 2023 Carl Schwan <carl@carlschwan.eu>
2// SPDX-License-Identifier: LGPL-2.0-or-later
3
4import QtQuick 2.15
5import QtQuick.Controls 2.15 as QQC2
6
7import org.kde.kirigami 2.19 as Kirigami
8
9QQC2.Button {
10 id: root
11
12 required property bool isEnd
13 required property bool isStart
14
15 readonly property color borderColor: if (enabled && (visualFocus || hovered || down)) {
16 return Kirigami.Theme.focusColor
17 } else {
18 return Kirigami.ColorUtils.linearInterpolation(Kirigami.Theme.backgroundColor, Kirigami.Theme.textColor, Kirigami.Theme.frameContrast)
19 }
20
21 visible: Kirigami.Settings.isMobile
22
23 contentItem: Item {
24 Kirigami.Icon {
25 source: root.icon.name
26 anchors.centerIn: parent
27 implicitHeight: Kirigami.Units.iconSizes.small
28 implicitWidth: Kirigami.Units.iconSizes.small
29 }
30 }
31
32 background: Kirigami.ShadowedRectangle {
33 implicitWidth: implicitHeight
34 implicitHeight: Kirigami.Units.gridUnit * 2
35
36 Kirigami.Theme.colorSet: Kirigami.Theme.Button
37 color: root.down ? Kirigami.Theme.alternateBackgroundColor: Kirigami.Theme.backgroundColor
38
39 corners {
40 topLeftRadius: (!root.mirrored && root.isStart) || (root.mirrored && root.isEnd) ? 4 : 0
41 bottomLeftRadius: (!root.mirrored && root.isStart) || (root.mirrored && root.isEnd) ? 4 : 0
42 topRightRadius: (!root.mirrored && root.isEnd) || (root.mirrored && root.isStart) ? 4 : 0
43 bottomRightRadius: (!root.mirrored && root.isEnd) || (root.mirrored && root.isStart) ? 4 : 0
44 }
45
46 border {
47 width: 1
48 color: root.borderColor
49 }
50 }
51}
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri May 3 2024 11:46:57 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.