Unsolved Custom QComplete
-
Hello Guys,
I use the QCompleter from this example
http://doc.qt.io/qt-5/qtwidgets-tools-customcompleter-textedit-cpp.html
with two modifications:
- Use completionPrefix.length() < 1 instead of completionPrefix.length() < 3
- Add a custom list
QAbstractItemModel *MainWindow::modelFromFile(const QString& fileName) { QStringList words = {"Cat", "dog", "fish", "rat", "bird", "lion", "elephant"}; return new QStringListModel(words, completer); }
If I start the programm, the first two words ("Cat" and "dog") are working pretty fine, but I don´t get any completition for the third word and so on:
What is wrong with this example?
Thanks for help!
-
hi
i tried your code
( not completionPrefix as didnt see it ) but your list
and it does work with fish using ctrl+e ? -
Hell mrjj,
thank you for your answer,
Yes, it works pretty fine with CTRL + E.
I mean the case when I type in "f", "i". For the word "cat" the auto complete window appears (see picture)But not for some other words like "lion"
I don´t really understand this behavior....
-
Sorry, the upload picture is broken so others cant seem them.
I re-tested and yes, its a bit odd that only some can auto pop.
-
Do you know why the auto completer do this?