mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 16:56:36 -04:00
if no tag completion, pass return to default button
This commit is contained in:
parent
9d02179875
commit
45ba91697e
1 changed files with 5 additions and 1 deletions
|
@ -36,15 +36,19 @@ class TagEdit(QLineEdit):
|
|||
|
||||
def keyPressEvent(self, evt):
|
||||
if evt.key() in (Qt.Key_Enter, Qt.Key_Return):
|
||||
oldtxt = self.text()
|
||||
if not self.text():
|
||||
evt.ignore()
|
||||
else:
|
||||
evt.accept()
|
||||
if self.completer.completionCount():
|
||||
self.setText(
|
||||
self.completer.pathFromIndex(self.completer.popup().currentIndex()))
|
||||
else:
|
||||
self.setText(self.completer.completionPrefix())
|
||||
if self.text() == oldtxt:
|
||||
evt.ignore()
|
||||
else:
|
||||
evt.accept()
|
||||
self.completer.popup().hide()
|
||||
return
|
||||
QLineEdit.keyPressEvent(self, evt)
|
||||
|
|
Loading…
Reference in a new issue