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. Using editable ComboBox
QtWS25 Last Chance

Using editable ComboBox

Scheduled Pinned Locked Moved Solved QML and Qt Quick
editablcomboboxcombobox
4 Posts 2 Posters 954 Views
  • 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.
  • K Offline
    K Offline
    koahnig
    wrote on last edited by
    #1

    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.

    Vote the answer(s) that helped you to solve your issue(s)

    J.HilkJ 1 Reply Last reply
    0
    • K koahnig

      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.

      J.HilkJ Offline
      J.HilkJ Offline
      J.Hilk
      Moderators
      wrote on last edited by
      #2

      hi @koahnig

      the important part is, where to you store/ assign the model to your combobox ?

      you'll have to react to the accepted signal of the combobox and add the new entry to the model to preserve it for the next creation


      Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


      Q: What's that?
      A: It's blue light.
      Q: What does it do?
      A: It turns blue.

      K 1 Reply Last reply
      1
      • J.HilkJ J.Hilk

        hi @koahnig

        the important part is, where to you store/ assign the model to your combobox ?

        you'll have to react to the accepted signal of the combobox and add the new entry to the model to preserve it for the next creation

        K Offline
        K Offline
        koahnig
        wrote on last edited by
        #3

        @J-Hilk

        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.

        Vote the answer(s) that helped you to solve your issue(s)

        1 Reply Last reply
        1
        • K Offline
          K Offline
          koahnig
          wrote on last edited by
          #4

          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.

          https://forum.qt.io/topic/120954/combobox-together-with-qstringlistmodel

          Vote the answer(s) that helped you to solve your issue(s)

          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