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

Editable QComboBox::setCurrentText and selectAll() changes currentIndex on enter key pressed

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 5.12.2
    • None
    • Linux/X11, Windows

    Description

      Hello,

       

      Problem: 

      I am adding text to editable QComboBox with setCurrentText() and then selectAll(). When the user presses Enter, it should validate the input.

      What is currently happening: it works for the first time but then it always goes back to the first index.

       

      Test case:

      I attach small test case (available on github https://github.com/p4lewandowski/QComboBox_bug): 

      1. Click on "Add entry" button (focus is given back to QComboBox).
      2. Press Enter to validate string (it works).
      3. Click on "Add entry" again.
      4. Press Enter to validate
        1. Display text is changed back to first input.
        2. You can check in the console QComboBox::currentText() is changed too.

      Use of selectAll() in my application is required to ease the next input.

      Similar issue without setCurrentText(), fixed, can be found here: https://bugreports.qt.io/browse/QTBUG-41288?jql=text%20~%20%22qcombobox%20selectall%22

       

      Attachments

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

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            plewandowski Przemyslaw Lewandowski
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes