Is there any way to have the QCompleter to act like an autocomplete for multiple words?
Someone has any idea how to do it?
I don't know if I understand correctly:
QStringList wordList;
wordList << "alpha and beta" << "omega" << "omicron" << "zeta";
QCompleter *completer = new QCompleter(wordList, this);
completer->setCaseSensitivity(Qt::CaseInsensitive);
QLineEdit *lineEdit = new QLineEdit(this);
lineEdit->setCompleter(completer);
If you type alp then you get the completion "alpha and beta" which is more than one word. There is no limit.
Update after clarifications:
Seems that what is requested is starting a new autocompletion after a delimiter value. In the current case this delimiter will be a space. An equivalent example would be the tree model completer from the Qt examples. This example illustrates how to solve the same situation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With