Select the first matching completion when opening a combobox completion popup

This commit is contained in:
Charles Haley 2012-07-02 14:04:18 +02:00
parent 61270a77dd
commit 6d165cbb61

View File

@ -164,9 +164,19 @@ class MultiCompleteComboBox(EnComboBox):
self.setLineEdit(self.le) self.setLineEdit(self.le)
def showPopup(self): def showPopup(self):
print 'here'
c = self.le._completer c = self.le._completer
v = unicode(c.currentCompletion())
print v
c.setCompletionPrefix('') c.setCompletionPrefix('')
c.complete() c.complete()
i = 0;
while c.setCurrentRow(i):
cr = unicode(c.currentIndex().data().toString())
if cr.startswith(v):
c.popup().setCurrentIndex(c.currentIndex())
return
i += 1
def update_items_cache(self, complete_items): def update_items_cache(self, complete_items):
self.lineEdit().update_items_cache(complete_items) self.lineEdit().update_items_cache(complete_items)