combobox still in progress

This commit is contained in:
2025-03-21 11:44:52 +01:00
parent d6034a5299
commit 8f6efac11e
9 changed files with 56 additions and 39 deletions

View File

@@ -7,7 +7,9 @@ T.ComboBox {
id: control
font: Typography.body
implicitHeight: implicitContentHeight + topInset + bottomInset
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
implicitContentHeight + topPadding + bottomPadding,
implicitIndicatorHeight + topPadding + bottomPadding)
contentItem: T.TextField {
@@ -17,7 +19,7 @@ T.ComboBox {
enabled: control.editable
font: Typography.body
implicitHeight: Typography.body.pixelSize + topPadding + bottomPadding + 2
implicitHeight: Typography.body.pixelSize + topPadding + bottomPadding
inputMethodHints: control.inputMethodHints
padding: Dimensions.m
readOnly: control.down
@@ -25,7 +27,7 @@ T.ComboBox {
text: control.editable ? control.editText : control.displayText
validator: control.validator
width: control.width - indicator.width
verticalAlignment: TextInput.AlignVCenter
verticalAlignment: Text.AlignVCenter
}
background: Rectangle {
border.color: Colors.interactive
@@ -35,22 +37,34 @@ T.ComboBox {
radius: Dimensions.radius
width: parent.width
}
delegate: MenuItem {
id: menuItem
// delegate: MenuItem {
// id: menuItem
required property int index
// required property int index
// required property var model
// highlighted: control.highlightedIndex === index
// hoverEnabled: control.hoverEnabled
// text: model[control.textRole]
// width: control.width
// background: Rectangle {
// color: menuItem.down || menuItem.highlighted ? Colors.primary : "transparent"
// height: menuItem.height
// width: menuItem.width
// }
// }
delegate: ItemDelegate {
required property var model
required property int index
width: ListView.view.width
text: model[control.textRole]
// palette.text: control.palette.text
// palette.highlightedText: control.palette.highlightedText
// font.weight: control.currentIndex === index ? Font.DemiBold : Font.Normal
highlighted: control.highlightedIndex === index
hoverEnabled: control.hoverEnabled
text: model[control.textRole]
width: control.width
background: Rectangle {
color: menuItem.down || menuItem.highlighted ? Colors.primary : "transparent"
height: menuItem.height
width: menuItem.width
}
}
indicator: Rectangle {
id: indicator
@@ -113,9 +127,6 @@ T.ComboBox {
}
Component.onCompleted:
{
console.log(test.height)
console.log(control.height)
console.log(test.font.pointSize)
console.log(test.font.pixelSize)
console.log(control.implicitContentHeight)
}
}