Important: Please read the Qt Code of Conduct -

ComboBox: Prevent editText from changing

  • Hey there,

    I want to prevent a QML ComboBox from automatically changing the editText whenever the underlying model changes its data.

    So the scenario is that the user may type in stuff, causing autocomplete suggestions to appear from online data.


    I am misusing the ComboBox for the autocompletions, and its model holds the available suggestions which are constantly changing depending on what the user has typed in.
    The problem is that as soon as I update the model with new suggestions, the editText property is changed to the empty string, effectively causing the suggestions to disappear again and ultimatively destroying everything that was typed in so far.

    So how can I prevent this from happening?

    P.S.: I would alternatively accept another widget for suggestions, but so far I haven't found an available Widget especially designed for search suggestions...

  • Moderators

    did you see the displayText property?
    Alternatively you may want to try a sortfilterproxy model?

Log in to reply