I know how to use QCompleter
class.
code:
QStringList wordList;
wordList << "alpha" << "omega" << "omicron" << "zeta";
QLineEdit *lineEdit = new QLineEdit(this);
QCompleter *completer = new QCompleter(wordList, this);
completer->setCaseSensitivity(Qt::CaseInsensitive);
lineEdit->setCompleter(completer);
But I want to join QString
like xxxxx.yyyyy
when I type xx
all the auto completion from that QStringlist
should appear drop down, so after I select the appropriate ones, if I enter .
auto completion form 2nd QStringList
should drop down.
I know I have not put across my point properly, but it is really tough to explain this.
A basic idea which came to my mind is that you should register a key press listener on that
QLineEdit
which only listens for.
character. Once user has entered a.
character you should prepend all characters have been entered so far to the secondQStringList
and feet it to theQCompleter
.Steps:
QStringList
..
, prepend what has been entered so far to the secondQStringList
and apply it to theQCompleter
.