Allow configuring combobox with whether they allow styled text or not

For some models we'd like to have the possibility to have rich text in the combobox. For some we'd like to prevent that, for instance to prevent the user from using colours in their profile names, or boldface, or even images.

Contributes to issue CURA-8849.
This commit is contained in:
Ghostkeeper 2022-06-14 15:09:34 +02:00
parent 5cfb6f94e3
commit 28c1291feb
No known key found for this signature in database
GPG key ID: D2A8871EE34EC59A

View file

@ -17,6 +17,8 @@ ComboBox
property var defaultTextOnEmptyModel: catalog.i18nc("@label", "No items to select from") // Text displayed in the combobox when the model is empty
property var defaultTextOnEmptyIndex: "" // Text displayed in the combobox when the model has items but no item is selected
property alias textFormat: contentLabel.textFormat
enabled: delegateModel.count > 0
onVisibleChanged: { popup.close() }
@ -146,7 +148,7 @@ ComboBox
anchors.rightMargin: UM.Theme.getSize("setting_unit_margin").width
text: delegateItem.text
textFormat: Text.PlainText
textFormat: control.textFormat
color: UM.Theme.getColor("setting_control_text")
elide: Text.ElideRight
wrapMode: Text.NoWrap