[SOLVED]Editable combobox that behaves more like a lineedit
I've made a form with a lineedit that usually ends up containing one of only a handful of possible values. What would be ideal is a free-form lineedit but with a dropdown for quickly filling it with one of the common strings if needed. I've experimented with an editable QComboBox which is almost right, except I don't want the drop-down items themselves be editable. The items should be read-only (something like the drop-down suggestions in a browser's URL field).
Also, it needs to play nice with QDataWidgetMapper in the sense that it can read and write QString values (i.e. just like a QLineEdit), rather than ints (i.e. the combobox's current index).
I have a separate QComboBox in the form that interfaces with the model through QDataWidgetMapper using the following code:
@mapper->addMapping(comboBox, 0, "currentIndex");@
This is OK because the corresponding section in the model is an integer type. QComboBox does have a "currentText" property, unfortunately it's only read-only.
Is there any way around this other than writing a new QLineEdit subclass?
Would a line edit with a "QCompleter":http://doc.qt.nokia.com/4.7/qcompleter.html work? That is more like a browser address line
That's just what I was after, thanks!