Fix initial down arrow in search box jumping two places

This commit is contained in:
Kovid Goyal 2017-06-10 22:58:28 +05:30
parent 58dc106004
commit 89fa38c712
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -213,12 +213,15 @@ class SearchBox2(QComboBox): # {{{
if k in (Qt.Key_Enter, Qt.Key_Return): if k in (Qt.Key_Enter, Qt.Key_Return):
return self.do_search() return self.do_search()
if k not in (Qt.Key_Up, Qt.Key_Down): if k not in (Qt.Key_Up, Qt.Key_Down):
QComboBox.keyPressEvent(self, event) return QComboBox.keyPressEvent(self, event)
else: self.blockSignals(True)
self.blockSignals(True) self.normalize_state()
self.normalize_state() if k == Qt.Key_Down and self.currentIndex() == 0 and not self.lineEdit().text():
QComboBox.keyPressEvent(self, event) self.setCurrentIndex(1), self.setCurrentIndex(0)
self.blockSignals(False) event.accept()
return
QComboBox.keyPressEvent(self, event)
self.blockSignals(False)
def completer_used(self, text): def completer_used(self, text):
self.timer.stop() self.timer.stop()