Warning, /frameworks/kirigami/src/controls/private/DefaultChipBackground.qml is written in an unsupported language. File is not indexed.

0001 // SPDX-FileCopyrightText: 2022 Felipe Kinoshita <kinofhek@gmail.com>
0002 // SPDX-License-Identifier: GPL-2.0-or-later
0003 
0004 import QtQuick
0005 import QtQuick.Controls as QQC2
0006 import QtQuick.Layouts
0007 import org.kde.kirigami as Kirigami
0008 
0009 Rectangle {
0010 
0011     /**
0012      * @brief This property holds the chip's default background color.
0013      */
0014     property color defaultColor: Kirigami.Theme.backgroundColor
0015 
0016     /**
0017      * @brief This property holds the color of the Chip's background when it is being pressed.
0018      * @see QtQuick.AbstractButton::down
0019      */
0020     property color pressedColor: Qt.rgba(Kirigami.Theme.highlightColor.r, Kirigami.Theme.highlightColor.g, Kirigami.Theme.highlightColor.b, 0.3)
0021 
0022     /**
0023      * @brief This property holds the color of the Chip's background when it is checked.
0024      * @see QtQuick.AbstractButton::checked
0025      */
0026     property color checkedColor: Qt.rgba(Kirigami.Theme.highlightColor.r, Kirigami.Theme.highlightColor.g, Kirigami.Theme.highlightColor.b, 0.2)
0027 
0028     /**
0029      * @brief This property holds the chip's default border color.
0030      */
0031     property color defaultBorderColor: Kirigami.ColorUtils.linearInterpolation(Kirigami.Theme.backgroundColor, Kirigami.Theme.textColor, Kirigami.Theme.frameContrast)
0032 
0033     /**
0034      * @brief This property holds the color of the Chip's border when it is checked.
0035      * @see QtQuick.AbstractButton::checked
0036      */
0037     property color checkedBorderColor: Qt.rgba(Kirigami.Theme.highlightColor.r, Kirigami.Theme.highlightColor.g, Kirigami.Theme.highlightColor.b, 0.9)
0038 
0039     /**
0040      * @brief This property holds the color of the Chip's border when it is being pressed.
0041      * @see QtQuick.AbstractButton::down
0042      */
0043     property color pressedBorderColor: Qt.rgba(Kirigami.Theme.highlightColor.r, Kirigami.Theme.highlightColor.g, Kirigami.Theme.highlightColor.b, 0.7)
0044 
0045     Kirigami.Theme.colorSet: Kirigami.Theme.Header
0046     Kirigami.Theme.inherit: false
0047 
0048     color: {
0049         if (parent.down) {
0050             return pressedColor
0051         } else if (parent.checked) {
0052             return checkedColor
0053         } else {
0054             return defaultColor
0055         }
0056     }
0057     border.color: {
0058         if (parent.down) {
0059             return pressedBorderColor
0060         } else if (parent.checked) {
0061             return checkedBorderColor
0062         } else {
0063             return defaultBorderColor
0064         }
0065     }
0066     border.width: 1
0067     radius: 3
0068 }