In QLineEdit it is planned to enter last names. How to make them automatically spelled depending on what the first letters were entered. Those. get pre-prepared text in QLineEdit. And, as a more complicated option, organize a drop-down list, if the entered first letters will coincide with several last names.
|
2 answers
For autocompletion, there is a QCompleter class:
QStringList list; list << "Some" << "Text" << "To" << "Complete"; QCompleter *completer = new QCompleter(list,this); ui->lineEdit->setCompleter(completer); Interface behavior is configured using setCompletionMode
And, as a more complicated option, organize a drop-down list, if the entered first letters will coincide with several last names.
This behavior corresponds to the default mode QCompleter::PopupCompletion
|
Replace QLineEdit with QComboBox . The latter has a complete dictionary.
- Then another question. In QComboBox, is it possible to enter text not from a dictionary? - yurasja
- @yurasja yes, there is such an opportunity. - gbg
|