Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-46904

Opening editable QCombobox aligns current index with its QLineEdit but still displays old index

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P3: Somewhat important P3: Somewhat important
    • None
    • 5.5.0 RC
    • None

      This bug originally had the following description, but its focus has changed upon further consideration. The summary is now accurate. See discussion in following comments.

      I know this is the expected behavior, but I believe it's a bit odd/non intuitive.
      The doc says:
      http://doc.qt.io/qt-5/qcombobox.html#currentText-prop
      "The setter setCurrentText() simply calls setEditText() if the combo box is editable."

      But if an item has the same text as one of the item values, this item doesn't get selected.
      IMO it would be better to first check for a corresponding item in the list and, if there is one, select it. If there is none, simply ignore it if the combobox isn't editable or call setEditText otherwise (current behavior).

      I've attached an small reproduce to illustrate what I mean, but I will create a code review to make things clearer.
      For reference, using git blame, it seems this new function was introduced with commit 84787d82ee9369b2a83c5b0568ee62ab602a5528.

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            arnaud.bienner Arnaud Bienner
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes