Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Using editable ComboBox
As the title says I am looking for an editable ComboBox in QML.
I have seen the examples and used already ComboBoxes in my applications. For static cases this is fine and easy to use.
I am struggling with implementing an editable, variable ComboBox. Part of the entries shall be fixed, but extendible through the user. Any addition shall be available for the next call or a new start of the application.
The editable property of ComboBox can be set. That is working, but when I choose a different entry and reopen the dialog again the added edited entry is gone.
Some guidance on this is appreciated.
the important part is, where to you store/ assign the model to your combobox ?
you'll have to react to the
acceptedsignal of the combobox and add the new entry to the model to preserve it for the next creation
Thanks for reply.
Finally I found this documentation entry https://doc.qt.io/qt-5/qml-qtquick-controls2-combobox.html#editable-combobox
That is providing some clue which route to go. It points also to ListModel as the way to go. At least with ListModel I could get some reasonable solution while other as a StringList as found in most examples are a dead end.
QML respectively is a bit confusing IMHO.
Thought initially that the issue could be completely solved in qml, but Settings seem to miss some features as present in QSettings. Therefore decided to move forward with solution based on C++ with QML.