Warning, /rolisteam/rolisteam/src/libraries/qml_views/rolistyle/ComboBox.qml is written in an unsupported language. File is not indexed.

0001 import QtQuick 2.15
0002 import QtQuick.Window 2.15
0003 import QtQuick.Controls 2.15
0004 import QtQuick.Controls.impl 2.15
0005 import QtQuick.Templates 2.15 as T
0006 import Customization 1.0
0007 
0008 T.ComboBox {
0009     id: control
0010     property QtObject style: Theme.styleSheet("Palette")
0011 
0012     implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
0013                             implicitContentWidth + leftPadding + rightPadding)
0014     implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
0015                              implicitContentHeight + topPadding + bottomPadding,
0016                              implicitIndicatorHeight + topPadding + bottomPadding)
0017 
0018     leftPadding: padding + (!control.mirrored || !indicator || !indicator.visible ? 0 : indicator.width + spacing)
0019     rightPadding: padding + (control.mirrored || !indicator || !indicator.visible ? 0 : indicator.width + spacing)
0020 
0021     delegate: ItemDelegate {
0022         width: parent.width
0023         text: control.textRole ? (Array.isArray(control.model) ? modelData[control.textRole] : model[control.textRole]) : modelData
0024         //palette.text: control.style.text
0025         //palette.highlightedText: control.style.highlightedText
0026         font.weight: control.currentIndex === index ? Font.DemiBold : Font.Normal
0027         highlighted: control.highlightedIndex === index
0028         hoverEnabled: control.hoverEnabled
0029     }
0030 
0031     indicator: ColorImage {
0032         x: control.mirrored ? control.padding : control.width - width - control.padding
0033         y: control.topPadding + (control.availableHeight - height) / 2
0034         color: control.style.dark
0035         defaultColor: "#353637"
0036         source: "qrc:/qt-project.org/imports/QtQuick/Controls/Basic/images/double-arrow.png"
0037         opacity: enabled ? 1 : 0.3
0038     }
0039 
0040     contentItem: T.TextField {
0041         leftPadding: !control.mirrored ? 12 : control.editable && activeFocus ? 3 : 1
0042         rightPadding: control.mirrored ? 12 : control.editable && activeFocus ? 3 : 1
0043         topPadding: 6 - control.padding
0044         bottomPadding: 6 - control.padding
0045 
0046         text: control.editable ? control.editText : control.displayText
0047 
0048         enabled: control.editable
0049         autoScroll: control.editable
0050         readOnly: control.down
0051         inputMethodHints: control.inputMethodHints
0052         validator: control.validator
0053 
0054         font: control.font
0055         color: control.editable ? control.style.text : control.style.buttonText
0056         selectionColor: control.style.highlight
0057         selectedTextColor: control.style.highlightedText
0058         verticalAlignment: Text.AlignVCenter
0059 
0060         background: Rectangle {
0061             visible: control.enabled && control.editable && !control.flat
0062             border.width: parent && parent.activeFocus ? 2 : 1
0063             border.color: parent && parent.activeFocus ? control.style.highlight : control.style.button
0064             color: control.style.base
0065         }
0066     }
0067 
0068     background: Rectangle {
0069         implicitWidth: 140
0070         implicitHeight: 40
0071 
0072         color: control.down ? control.style.mid : control.style.button
0073         border.color: control.style.highlight
0074         border.width: !control.editable && control.visualFocus ? 2 : 0
0075         visible: !control.flat || control.down
0076     }
0077 
0078     popup: T.Popup {
0079         y: control.height
0080         width: control.width
0081         height: Math.min(contentItem.implicitHeight, control.Window.height - topMargin - bottomMargin)
0082         topMargin: 6
0083         bottomMargin: 6
0084 
0085         contentItem: ListView {
0086             clip: true
0087             implicitHeight: contentHeight
0088             model: control.delegateModel
0089             currentIndex: control.highlightedIndex
0090             highlightMoveDuration: 0
0091 
0092             Rectangle {
0093                 z: 10
0094                 width: parent.width
0095                 height: parent.height
0096                 color: "transparent"
0097                 border.color: control.style.mid
0098             }
0099 
0100             T.ScrollIndicator.vertical: ScrollIndicator { }
0101         }
0102 
0103         background: Rectangle {
0104             color: control.style.window
0105         }
0106     }
0107 }
0108