ComboBox: change text in dropdown
Solved
QML and Qt Quick
-
The
displayText
property 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