Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QCompleter auto Selection Row



  • hello. i have a QCompleter and TableView

    453647bb-0238-4f51-b331-fb075f74cd2d-image.png

    If I type A in LineEdit, I want the Auto Selection to be A in PopupView.

    Even if you change the view selection with the arrow keys, I don't want it to be applied to LineEdit the same way, and I want it to be applied only when I return.

    What should I do?



  • @Qt-Jo-Ha
    I am a bit slow, so I don't always understand user questions as quickly as some of the other respondents here... !

    First: am I right in thinking is that the left-hand view is how you want it and the right-hand view is how it behaves at present? Or is that not the case?

    Second: if that is the case, am I right that what you show indicates that plain letter A is not initially in the QCompleter's completion list? The list only has (matching) AB & ABC in it? So what you want is to be offered what you have typed so far, whether it's in the list or not, plus what is actually matching in the list?

    Then you press Return when you're ready on your selection. The item you pick might be one in the list, or it might be what you typed so far, even if it's not in the list?



  • Thank you for answer @JonB

    The first picture and the second picture are all pictures I want. If there are A, AB, and ABC in the information of ViewModel, input A and all 3 will appear.

    In the photo, as soon as you type and the PopUp View comes out, you can see that it is highlighted in the first row, but the current operation is not.

    The current behavior is that when you type A, the first row is not highlighted, and if you change the row selection using the arrow keys, the text in LineEdit changes according to the SelectRow.

    The action I want is that Selection is automatically set to A when A is entered, and I don't want the Text to change when the Select Row is changed with the arrow keys.


Log in to reply