HComboBox: allow popup and indicator to be null
This commit is contained in:
parent
c9ee604cf3
commit
67edd63c5a
|
@ -13,6 +13,10 @@ ComboBox {
|
||||||
property color focusedBackgroundColor:
|
property color focusedBackgroundColor:
|
||||||
theme.controls.textField.focusedBackground
|
theme.controls.textField.focusedBackground
|
||||||
|
|
||||||
|
readonly property bool popupVisible: popup && popup.visible
|
||||||
|
|
||||||
|
readonly property alias field: field
|
||||||
|
|
||||||
spacing: 0
|
spacing: 0
|
||||||
|
|
||||||
background: Rectangle {
|
background: Rectangle {
|
||||||
|
@ -34,12 +38,13 @@ ComboBox {
|
||||||
background: null
|
background: null
|
||||||
text: root.displayText
|
text: root.displayText
|
||||||
readOnly: ! root.editable
|
readOnly: ! root.editable
|
||||||
rightPadding: root.indicator.width + theme.spacing
|
rightPadding:
|
||||||
|
(root.indicator ? root.indicator.width : 0) + theme.spacing
|
||||||
|
|
||||||
TapHandler {
|
TapHandler {
|
||||||
enabled: field.readOnly
|
enabled: field.readOnly
|
||||||
onTapped:
|
onTapped:
|
||||||
root.popup.visible ? root.popup.close() : root.popup.open()
|
root.popupVisible ? root.popup.close() : root.popup.open()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,9 +52,10 @@ ComboBox {
|
||||||
x: root.width - root.rightPadding
|
x: root.width - root.rightPadding
|
||||||
height: root.availableHeight
|
height: root.availableHeight
|
||||||
backgroundColor: "transparent"
|
backgroundColor: "transparent"
|
||||||
icon.name: "combo-box-" + (root.popup.visible ? "close" : "open")
|
icon.name: "combo-box-" + (root.popupVisible ? "close" : "open")
|
||||||
|
|
||||||
iconItem.small: true
|
iconItem.small: true
|
||||||
onClicked: root.popup.visible ? root.popup.close() : root.popup.open()
|
onClicked: root.popupVisible ? root.popup.close() : root.popup.open()
|
||||||
}
|
}
|
||||||
|
|
||||||
popup: HMenu {
|
popup: HMenu {
|
||||||
|
@ -90,7 +96,7 @@ ComboBox {
|
||||||
}
|
}
|
||||||
|
|
||||||
Repeater {
|
Repeater {
|
||||||
model: root.popup.visible ? root.model : null
|
model: root.popupVisible ? root.model : null
|
||||||
delegate: root.delegate
|
delegate: root.delegate
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user