I currently develop an application who support PyQt4 and PyQt5.
I have a QLineEdit with a QCompleter (with a QStringListModel). I want when user type inside QLineEdit, the completer propose matching case.
Ex: I have host-001
inside my list and user type 001
, I want QLineEdit propose host-001
.
I've found a way to do that with PyQt5:
host_list = ['host-001', 'host-002', 'host-003']
model = QStringListModel()
model.setStringList(hosts_list)
completer = QCompleter()
completer.setFilterMode(Qt.MatchContains)
completer.setModel(model)
line_search = QLineEdit()
line_search.setCompleter(completer)
With PyQt4 the problem is that this method does not exist, but Qt.MatchContains
yes.
I've search on doc but can't found how to use it. How can I do ?