Autocomplete text field in qt?

I'm new to QT, how to implement the autocomplete text box in qt or is there already a solution for this? I have a vector of words. Can someone give me advice on how to do this?

+5
source share
2 answers

Take a look at QCompleter .

The QCompleter class provides shutdown based on the item model.

You can use QCompleter to provide automatic completion in any Qt widgets such as QLineEdit and QComboBox. When a user begins to enter a word, QCompleter offers possible ways to populate a word based on a list of words. A list of words is provided as a QAbstractItemModel. (For simple applications where the word list is static, you can pass a QStringList to the QCompleter constructor.)

+14
source

You can use QComboBoxwith the attribute editableset totrue.

+2
source

All Articles