if no tag completion, pass return to default button

This commit is contained in:
Damien Elmes 2010-01-29 17:22:41 +09:00
parent 9d02179875
commit 45ba91697e

View file

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