Qt 6.11 is out! See what's new in the release
blog
ComboBox: change text in dropdown
-
The
displayTextproperty allows to change the visualization of the current item. For example:ComboBox { model: myModel displayText: currentText.replace('*',''); }Now if the item contains a '*' it will be removed. But this happens only when the combo box is closed. I want to do the same also when the dropdown is open. How to do this?
-
The
displayTextproperty allows to change the visualization of the current item. For example:ComboBox { model: myModel displayText: currentText.replace('*',''); }Now if the item contains a '*' it will be removed. But this happens only when the combo box is closed. I want to do the same also when the dropdown is open. How to do this?
@Mark81 hi,
One way to do that is writing your own delegate for the ComboBoxComboBox { model: ["ds*f","f","ff*f"] displayText: currentText.replace('*',''); delegate: Text{ text : modelData.replace('*',''); } }or just clean your model before passing it to your ComboBox