Reputation: 126095
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
QComboBox
with insertion set to noAdvantages
Disadvantages
Upvotes: 2
Views: 5094
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