don't throw error completing empty tag, hide popup, propagate key event

This commit is contained in:
Damien Elmes 2009-05-16 03:50:58 +09:00
parent 484b15f592
commit 6f2f253d96

View file

@ -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)