PDA

View Full Version : QCompleter multiple completion modes



chezifresh
12th March 2010, 22:25
I have a QLineEdit (http://doc.trolltech.com/latest/qlineedit.html) for the user to enter a path and I have a QCompleter (http://doc.trolltech.com/latest/qcompleter.html) with a QDirModel (http://doc.trolltech.com/latest/qdirmodel.html) which works great for auto-completion. Here's how thats done...


QLineEdit * file_lineedit = new QLineEdit(this);
QDirModel * file_model = new QDirModel();
QCompleter * file_completer = new QCompleter(file_model, this);
file_lineedit->setCompleter(file_completer);
The default completion mode is QCompleter::PopupCompletion. But I would very much like it to have PopupCompletion and InlineCompletion. That way you get a drop down of the completion possibilities but it auto selects the closest completion. Any ideas?

As far as I can tell
completer->setCompletionMode(QCompleter::PopupCompletion | QCompleter::InlineCompletion) doesnt work