mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 16:56:36 -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):
|
def keyPressEvent(self, evt):
|
||||||
if evt.key() in (Qt.Key_Enter, Qt.Key_Return):
|
if evt.key() in (Qt.Key_Enter, Qt.Key_Return):
|
||||||
evt.accept()
|
evt.ignore()
|
||||||
if self.completer.completionCount():
|
if not self.text():
|
||||||
|
pass
|
||||||
|
elif self.completer.completionCount():
|
||||||
self.setText(
|
self.setText(
|
||||||
self.completer.pathFromIndex(self.completer.popup().currentIndex()))
|
self.completer.pathFromIndex(self.completer.popup().currentIndex()))
|
||||||
else:
|
else:
|
||||||
self.setText(self.completer.completionPrefix())
|
self.setText(self.completer.completionPrefix())
|
||||||
|
self.completer.popup().hide()
|
||||||
return
|
return
|
||||||
QLineEdit.keyPressEvent(self, evt)
|
QLineEdit.keyPressEvent(self, evt)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue