I have data coming from two places one by this
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)
def __pathsList(self):
defaultList = self.xmlDataObj.xmlData().values()
completerList = QtCore.QStringList()
for i in defaultList:
completerList.append(QtCore.QString(i))
lineEditCompleter = QtGui.QCompleter(completerList)
# lineEditCompleter.setCompletionMode(QtGui.QCompleter.UnfilteredPopupCompletion)
self.addPathEdit.setCompleter(lineEditCompleter)
To copy to clipboard, switch view to plain text mode
and second by
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)
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 = QtGui.QCompleter(dirModel,self)
completer.setModel(dirModel)
print dir(completer)
completer.setCaseSensitivity(QtCore.Qt.CaseInsensitive)
self.addPathEdit.setCompleter(completer)
To copy to clipboard, switch view to plain text mode
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
Bookmarks