Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. ComboBox: Prevent editText from changing

ComboBox: Prevent editText from changing

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
2 Posts 2 Posters 763 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Magnus21
    wrote on last edited by Magnus21
    #1

    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.

    0_1503336322312_temp.png

    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...

    raven-worxR 1 Reply Last reply
    1
    • M Magnus21

      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.

      0_1503336322312_temp.png

      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...

      raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by raven-worx
      #2

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

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved