[PyQt] [pyqt]Replace a character in qlineedit from a dictionary(Qcompleter?)

Maziar Parsijani maziar.parsijani at gmail.com
Wed Sep 5 13:25:17 BST 2018


Hi
I use the following code for qcompleter .In this method if you write "c"
then you can just choose  "completion" or any other is starts with "c" in
the stringlist.

def get_data(model):    model.setStringList(["completion", "data",
"goes", "here"])    edit = QLineEdit()    completer = QCompleter()
edit.setCompleter(completer)    model = QStringListModel()
completer.setModel(model)    get_data(model)

 how could I replace a character that is not related to the input.for
example :


StringList(["b","a","c","d"])

I want to be able when a key like  *"h"* pressed or input the completer
menu appears and would be able to choose "b"or"a"or"c"or"d" and *replace*
it in the qlineedit character.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20180905/6fbe66b2/attachment.html>


More information about the PyQt mailing list