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

Maziar Parsijani maziar.parsijani at gmail.com
Fri Sep 7 19:20:50 BST 2018

I Have found an answer to this problem but still I want to know how to set
a bigger font for pop-up window :

class CustomCompleter(QCompleter):
    def __init__(self):
    def splitPath(self,path):
        if path.endswith('ا'):
            self.setModel(QStringListModel(['أ', 'إ', 'آ', 'ٱ']))
        elif path.endswith('ی'):
        elif path.endswith('ک'):
            return []
        return []

e = QLineEdit()
c = CustomCompleter()

On Wed, Sep 5, 2018 at 4:55 PM Maziar Parsijani <maziar.parsijani at gmail.com>

> 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/20180907/7e1dd7e2/attachment.html>

More information about the PyQt mailing list