Triggering the completer codewise
Hi,
For 2 days I am stuggling with de completer in PYQT. I expect the solution to be quite simple but, can't figure it out.
I want to use the completer to show suggestions in a Popup screen under a QLineEdit. If I type in my QLineEdit everything works great, but if I fill the QLineEdit with a command (I use an on screen keyboard) the popup is not displayed.
Just to illustrate I got the problem caught in a small sample program, if I type in de QLineEdit it's OK, If I press the Button it doesn't do anything.....
Regards,
Sytse
Code:
import sys
def handleButton(model):
edit.setText('co')
def get_data(model):
model.setStringList(["completion", "data", "goes", "here"])
if __name__ == "__main__":
edit.setCompleter(completer)
completer.setModel(model)
get_data(model)
edit.textChanged.connect(completer.setCompletionPrefix)
app.button.clicked.connect(handleButton)
edit.show()
app.button.show()
sys.exit(app.exec_())