mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 08:46:37 -04:00
don't throw error completing empty tag, hide popup, propagate key event
This commit is contained in:
parent
484b15f592
commit
6f2f253d96
1 changed files with 5 additions and 2 deletions
|
@ -36,12 +36,15 @@ class TagEdit(QLineEdit):
|
|||
|
||||
def keyPressEvent(self, evt):
|
||||
if evt.key() in (Qt.Key_Enter, Qt.Key_Return):
|
||||
evt.accept()
|
||||
if self.completer.completionCount():
|
||||
evt.ignore()
|
||||
if not self.text():
|
||||
pass
|
||||
elif self.completer.completionCount():
|
||||
self.setText(
|
||||
self.completer.pathFromIndex(self.completer.popup().currentIndex()))
|
||||
else:
|
||||
self.setText(self.completer.completionPrefix())
|
||||
self.completer.popup().hide()
|
||||
return
|
||||
QLineEdit.keyPressEvent(self, evt)
|
||||
|
||||
|
|
Loading…
Reference in a new issue