Set ComboBox text to something not in model
Unsolved
QML and Qt Quick
-
Hi,
i have a QML file with a ComboBox in it..... ComboBox { id: searchForComboBox objectName: "searchFor" anchors.margins: 2 currentIndex: 0 editable: true clip: true model: searchComboBoxModel width: 200 editText: "abc" // <-- Problem here } ....
I need to set the text in the box to something that is not in the model. It should be used to indicate that nothing was selected in the combobox.
I tried the 'editText' property, but it seems it will be ignored. My combobox always selects the first model item on startup. -
With Qt Quick Controls 2, you can set ComboBox::displayText to anything you like: http://doc-snapshots.qt.io/qt5-5.7/qml-qtquick-controls2-combobox.html#displayText-prop