popping up completion on QLineEdit focusIn and changing completer on user input
I have data coming from two places one by this
Code:
def __pathsList(self):
defaultList = self.xmlDataObj.xmlData().values()
for i in defaultList:
completerList.
append(QtCore.
QString(i
)) lineEditCompleter
= QtGui.
QCompleter(completerList
) # lineEditCompleter.setCompletionMode(QtGui.QCompleter.UnfilteredPopupCompletion)
self.addPathEdit.setCompleter(lineEditCompleter)
and second by
Code:
def __dirCompleter(self):
# completer = TagsCompleter(self.addPathEdit, self.xmlDataObj.xmlData().values())
dirModel = QtGui.QFileSystemModel()
dirModel.
setRootPath(QtCore.
QDir.
currentPath()) dirModel.
setFilter(QtCore.
QDir.
AllDirs | QtCore.
QDir.
NoDotAndDotDot | QtCore.
QDir.
Files) dirModel.setNameFilterDisables(0)
completer.setModel(dirModel)
print dir(completer)
completer.setCaseSensitivity(QtCore.Qt.CaseInsensitive)
self.addPathEdit.setCompleter(completer)
I want the first method to execute when the QLineEdit is in focus, but the second one to execute when user types "/" for OSx or Linux or single alphabet for windows users.
what I do not know is how to show the list right away when the QLineEdit is in focus but instead the QCompleter popups the list on typing "/" when I want when the user enters "/" then the second methods does the QCompleteion for dirCompletion .
Any help will be greatly appreciated,
Regards