Solved How to make input field with list under it contain suggestions?
-
as you can see from this photo I'm trying to make a input field with suggestions under it in a list
can anyone know how to do it -
Hi and welcome
You can use QCompleter
http://doc.qt.io/qt-5/qtwidgets-tools-completer-example.html
here it uses files but list can be anything.http://doc.qt.io/qt-5/qtwidgets-tools-customcompleter-example.html
-
@mrjj is there a way to use QCompleter in form design
-
@davidlabib
nope as its not visual.
But you can assign it to Edit you have placed on form. (UI)
so almost yes.
All it takes is(after setupUI()) QStringList wordList; wordList << "alpha" << "omega" << "omicron" << "zeta"; QCompleter *completer = new QCompleter(wordList, this); completer->setCaseSensitivity(Qt::CaseInsensitive); ui->lineEdit->setCompleter(completer);
-
@mrjj thanks a lot