mirror of
https://github.com/ankitects/anki.git
synced 2025-09-25 01:06:35 -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())
|
l = sorted(self.col.decks.allNames())
|
||||||
self.model.setStringList(l)
|
self.model.setStringList(l)
|
||||||
|
|
||||||
# def addTags(self, tags):
|
def focusInEvent(self, evt):
|
||||||
# l = list(set([unicode(x) for x in list(self.model.stringList())] +
|
QLineEdit.focusInEvent(self, evt)
|
||||||
# tags))
|
self.showCompleter()
|
||||||
# l.sort(key=lambda x: x.lower())
|
|
||||||
# self.model.setStringList(l)
|
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):
|
def focusOutEvent(self, evt):
|
||||||
QLineEdit.focusOutEvent(self, evt)
|
QLineEdit.focusOutEvent(self, evt)
|
||||||
|
|
Loading…
Reference in a new issue