Nominate our 2022 Qt Champions!

QCompleter highlight item as the user types ahead how to.

  • QCompleter.

    I reviewed the sample completer and it does most of what I want its excellent.

    I would like it to behave like the completer in the int Qt Editor
    where the user can list the methods for an object and it highlights the name as he types.

    I want the user to be able to type ahead to a list but only allow them to pick from the list and only from the list. Its a more restrictive case.

    Also I noticed the pop up window does NOT stay with the parent window.
    When I move the parent window the pop list stays in its current position.

    Does anyone know how i can make the pop up behave like I want.

    Frank M.

  • Lifetime Qt Champion


    Unless I'm mistaken, your description makes me think about a QComboBox rather than a QLineEdit + QCompleter. Wouldn't that combo do what you want ?

    As for the popup bug, can you reproduce this with a minimal compilable example ?

  • As for the floating window NOT being anchored you can try the completer examples
    they all behave the same. Run it have the completer get activated then move the window behind it before you make a selection.
    You will able able to move it and have the completer view stay in its original spot I am on a MAC.

    see: Qt/Examples/Qt-5.4/widgets/tools/completer

    As for a combo box it doesn't work the same as the pop completer view. You have to continue to type and it will move to the item. But if you
    pause between key strokes it resets its type ahead information.

Log in to reply