Warning, /plasma/qqc2-breeze-style/style/impl/ComboBoxBackground.qml is written in an unsupported language. File is not indexed.

0001 /* SPDX-FileCopyrightText: 2020 Noah Davis <noahadvs@gmail.com>
0002  * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0003  */
0004 
0005 /*
0006  * This file exists mainly because ComboBox's `highlighted` has the same name,
0007  * but a completely different meaning from Button's `highlighted`.
0008  *
0009  * ComboBox::highlighted(int index)
0010  * This signal is emitted when the item at index in the popup list is highlighted by the user.
0011  */
0012 
0013 import QtQuick
0014 import QtQuick.Templates as T
0015 import org.kde.kirigami as Kirigami
0016 
0017 import "." as Impl
0018 
0019 Rectangle {
0020     id: mainBackground
0021 
0022     property T.ComboBox control: mainBackground.parent
0023 
0024     property color flatColor: Qt.rgba(
0025         Kirigami.Theme.backgroundColor.r,
0026         Kirigami.Theme.backgroundColor.g,
0027         Kirigami.Theme.backgroundColor.b,
0028         0
0029     )
0030     property bool highlightBackground: control.down
0031     property bool highlightBorder: control.down || control.visualFocus || control.hovered
0032 
0033     implicitWidth: 200
0034     implicitHeight: Impl.Units.mediumControlHeight
0035 
0036     visible: !control.flat || control.editable || control.down || control.visualFocus || control.hovered
0037 
0038     color: {
0039         if (highlightBackground) {
0040             return Kirigami.Theme.alternateBackgroundColor
0041         } else if (control.flat) {
0042             return flatColor
0043         } else {
0044             return Kirigami.Theme.backgroundColor
0045         }
0046     }
0047 
0048     border {
0049         color: highlightBorder ?
0050             Kirigami.Theme.focusColor : Impl.Theme.buttonSeparatorColor()
0051         width: Impl.Units.smallBorder
0052     }
0053 
0054     Behavior on color {
0055         enabled: highlightBackground
0056         ColorAnimation {
0057             duration: Kirigami.Units.shortDuration
0058             easing.type: Easing.OutCubic
0059         }
0060     }
0061     Behavior on border.color {
0062         enabled: highlightBorder
0063         ColorAnimation {
0064             duration: Kirigami.Units.shortDuration
0065             easing.type: Easing.OutCubic
0066         }
0067     }
0068 
0069     radius: Impl.Units.smallRadius
0070 
0071     SmallBoxShadow {
0072         id: shadow
0073         opacity: control.down ? 0 : 1
0074         visible: !control.editable && !control.flat && control.enabled
0075         radius: parent.radius
0076     }
0077 
0078     FocusRect {
0079         id: focusRect
0080         baseRadius: mainBackground.radius
0081         visible: control.visualFocus
0082     }
0083 }