Kirigami2

DefaultChipBackground.qml
1// SPDX-FileCopyrightText: 2022 Felipe Kinoshita <kinofhek@gmail.com>
2// SPDX-License-Identifier: GPL-2.0-or-later
3
4import QtQuick
5import org.kde.kirigami as Kirigami
6
7Rectangle {
8
9 /**
10 * @brief This property holds the chip's default background color.
11 */
12 property color defaultColor: Kirigami.Theme.backgroundColor
13
14 /**
15 * @brief This property holds the color of the Chip's background when it is being pressed.
16 * @see QtQuick.AbstractButton::down
17 */
18 property color pressedColor: Qt.rgba(Kirigami.Theme.highlightColor.r, Kirigami.Theme.highlightColor.g, Kirigami.Theme.highlightColor.b, 0.3)
19
20 /**
21 * @brief This property holds the color of the Chip's background when it is checked.
22 * @see QtQuick.AbstractButton::checked
23 */
24 property color checkedColor: Qt.rgba(Kirigami.Theme.highlightColor.r, Kirigami.Theme.highlightColor.g, Kirigami.Theme.highlightColor.b, 0.2)
25
26 /**
27 * @brief This property holds the chip's default border color.
28 */
29 property color defaultBorderColor: Kirigami.ColorUtils.linearInterpolation(Kirigami.Theme.backgroundColor, Kirigami.Theme.textColor, Kirigami.Theme.frameContrast)
30
31 /**
32 * @brief This property holds the color of the Chip's border when it is checked.
33 * @see QtQuick.AbstractButton::checked
34 */
35 property color checkedBorderColor: Qt.rgba(Kirigami.Theme.highlightColor.r, Kirigami.Theme.highlightColor.g, Kirigami.Theme.highlightColor.b, 0.9)
36
37 /**
38 * @brief This property holds the color of the Chip's border when it is being pressed.
39 * @see QtQuick.AbstractButton::down
40 */
41 property color pressedBorderColor: Qt.rgba(Kirigami.Theme.highlightColor.r, Kirigami.Theme.highlightColor.g, Kirigami.Theme.highlightColor.b, 0.7)
42
43 Kirigami.Theme.colorSet: Kirigami.Theme.Header
44 Kirigami.Theme.inherit: false
45
46 color: {
47 if (parent.down) {
48 return pressedColor
49 } else if (parent.checked) {
50 return checkedColor
51 } else {
52 return defaultColor
53 }
54 }
55 border.color: {
56 if (parent.down) {
57 return pressedBorderColor
58 } else if (parent.checked) {
59 return checkedBorderColor
60 } else {
61 return defaultBorderColor
62 }
63 }
64 border.width: 1
65 radius: Kirigami.Units.cornerRadius
66}
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri May 17 2024 11:49:07 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.