Qt Completable Line Edit
Completion of input text as user is typing is a wonderful feature of modern user interface. You find it for example within KDE line edits, or in Firefox input boxes. Unfortunately, it is not part of standard Qt. Of course, you can use KDE widgets KComboBox and KLineEdit that does this very well but it forces you to link with KDE which can be a pain and prevents you from targetting multi-platforms.
Hopefully, since the Qt code is open, it is possible to vampirize the code of a QComboBox and implement a light yet powerful completable line edit. This is what this page presents. It features 4 classes:
- Completer
- PoolCompleter
- SqlCompleter
- CompletableLineEdit
That implements a widget, an abstract completion strategy and two implementations. Here is a simple example of how you can use it.