mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 16:56:36 -04:00
show completer on focus or key change
This commit is contained in:
parent
167dc79550
commit
c9ce7045fb
1 changed files with 11 additions and 5 deletions
|
@ -29,11 +29,17 @@ class TagEdit(QLineEdit):
|
|||
l = sorted(self.col.decks.allNames())
|
||||
self.model.setStringList(l)
|
||||
|
||||
# def addTags(self, tags):
|
||||
# l = list(set([unicode(x) for x in list(self.model.stringList())] +
|
||||
# tags))
|
||||
# l.sort(key=lambda x: x.lower())
|
||||
# self.model.setStringList(l)
|
||||
def focusInEvent(self, evt):
|
||||
QLineEdit.focusInEvent(self, evt)
|
||||
self.showCompleter()
|
||||
|
||||
def keyPressEvent(self, evt):
|
||||
QLineEdit.keyPressEvent(self, evt)
|
||||
self.showCompleter()
|
||||
|
||||
def showCompleter(self):
|
||||
self.completer.setCompletionPrefix(self.text())
|
||||
self.completer.complete()
|
||||
|
||||
def focusOutEvent(self, evt):
|
||||
QLineEdit.focusOutEvent(self, evt)
|
||||
|
|
Loading…
Reference in a new issue