PyQt QCompleter model

nusch nuschpl at gmail.com
Wed Sep 16 19:14:22 EDT 2009


The following code:


strings=["asdad", "baasd", "casd", "caxd"]
completer = QCompleter(strings)
model = completer.model()
print model.rowCount()
model.stringList().append("test")
print model.rowCount()


prints 4 before and after appending test to stringList. What should I
do to let the model know about new data? I can save reference to
model.stringList() append keyword and after pass this reference as an
argument to setStringList then last model.rowCount() increases, but it
is not efficient when operating with e.g 20000 words in such list.

Is there better way to do this? Or  is there any other method with
simply allow to add word to Qcompleter without using .stringList() >



More information about the Python-list mailing list