Style code
This commit is contained in:
@@ -2,14 +2,16 @@ import QtQuick
|
||||
import QtQuick.Templates as T
|
||||
import QtQuick.Controls
|
||||
|
||||
T.ComboBox {
|
||||
T.ComboBox
|
||||
{
|
||||
id: control
|
||||
|
||||
font: Typography.body
|
||||
implicitHeight: background.height
|
||||
padding: Dimensions.m
|
||||
|
||||
background: Rectangle {
|
||||
background: Rectangle
|
||||
{
|
||||
border.color: Colors.interactive
|
||||
border.width: 1
|
||||
color: Colors.mantle
|
||||
@@ -17,12 +19,14 @@ T.ComboBox {
|
||||
radius: Dimensions.radius
|
||||
}
|
||||
|
||||
delegate: T.ItemDelegate {
|
||||
delegate: T.ItemDelegate
|
||||
{
|
||||
width: control.width
|
||||
height: implicitContentHeight + topPadding + bottomPadding
|
||||
padding: Dimensions.s
|
||||
leftPadding: control.leftPadding
|
||||
contentItem: Label {
|
||||
contentItem: Label
|
||||
{
|
||||
text: control.textRole ? model[control.textRole] : modelData
|
||||
color: Colors.foreground
|
||||
elide: Text.ElideRight
|
||||
@@ -30,7 +34,8 @@ T.ComboBox {
|
||||
}
|
||||
highlighted: control.highlightedIndex === index
|
||||
}
|
||||
indicator: Label {
|
||||
indicator: Label
|
||||
{
|
||||
x: control.width - width
|
||||
height: control.height
|
||||
width: contentWidth + Dimensions.s * 2
|
||||
@@ -39,7 +44,8 @@ T.ComboBox {
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
padding: Dimensions.s
|
||||
|
||||
background: Rectangle {
|
||||
background: Rectangle
|
||||
{
|
||||
anchors.fill: parent
|
||||
color: Colors.primary
|
||||
topRightRadius: Dimensions.radius
|
||||
@@ -48,17 +54,20 @@ T.ComboBox {
|
||||
}
|
||||
}
|
||||
|
||||
popup: T.Popup {
|
||||
popup: T.Popup
|
||||
{
|
||||
y: control.height
|
||||
z: 2
|
||||
width: control.width
|
||||
contentItem: ListView {
|
||||
contentItem: ListView
|
||||
{
|
||||
clip: true
|
||||
implicitHeight: contentHeight
|
||||
model: control.popup.visible ? control.delegateModel : null
|
||||
currentIndex: control.highlightedIndex
|
||||
|
||||
highlight: Rectangle {
|
||||
highlight: Rectangle
|
||||
{
|
||||
color: Colors.primary
|
||||
opacity: Colors.highlightOpacity
|
||||
}
|
||||
@@ -66,10 +75,11 @@ T.ComboBox {
|
||||
ScrollIndicator.vertical: ScrollIndicator {}
|
||||
}
|
||||
|
||||
background: Rectangle {
|
||||
background: Rectangle
|
||||
{
|
||||
color: Colors.mantle
|
||||
border.color: Colors.interactive
|
||||
radius: Dimensions.radius
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user