Search code examples
pythoncomboboxautocompletepyqt4qcombobox

How to create autocomplete combobox in PyQt4?


How to create autocomplete combobox in PyQt4?

Example what I want:

http://jqueryui.com/autocomplete/#combobox


Solution

  • To get the same behaviour as in the example, you will need to change the completion mode of the completer for the combobox.

    By default, the completion mode is inline (i.e. just selected text, with no alternatives). To get the drop-down list of possible alternatives, do:

        combobox.completer().setCompletionMode(QtGui.QCompleter.PopupCompletion)