Georg Schölly
Georg Schölly

Reputation: 126095

Can I make QCompleter complete inline and show a popup

Qt 4.5 (PyQt 4.6.1)

I'm looking for a widget similar to a QComboBox that automatically filters its entries to the ones starting with the input in the text field. There are around 300 items in the combo box.

I've tried two approaches:

QLineEdit with QCompleter

Advantages

Disadvantages

Editable QComboBox with insertion set to no

Advantages

Disadvantages

What I need

Upvotes: 2

Views: 5094

Answers (1)

Patrice Bernassola
Patrice Bernassola

Reputation: 14416

Concerning you first try with QLineEdit, you can set the completionMode to do it inline.

For your second try, you can add a QCompleter object to you QCombBox in order to filter your items as you want.The QCompleter member of the QComboBox is to offer an easy way to use QCompleter.

Anyway, if you are not satisfied with this method, you can manage a QCompleter object by yourself. This allows you to choose how item list is display (using any views) and to define items order in the list. See basic QCompleter details.

Upvotes: 1

Related Questions