From 28c1291febebbb6f93f9eca00067cca89c96d084 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 14 Jun 2022 15:09:34 +0200 Subject: 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. --- resources/qml/Widgets/ComboBox.qml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'resources/qml') diff --git a/resources/qml/Widgets/ComboBox.qml b/resources/qml/Widgets/ComboBox.qml index 988b7c3782..f85c5d060b 100644 --- a/resources/qml/Widgets/ComboBox.qml +++ b/resources/qml/Widgets/ComboBox.qml @@ -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 -- cgit v1.2.3