auto refill selected value of filter combobox on focus out

This commit is contained in:
iLLiCiTiT 2021-05-12 15:58:15 +02:00
parent 4319136dd8
commit 6e16479d22

View file

@ -57,6 +57,15 @@ class FilterComboBox(QtWidgets.QComboBox):
super(FilterComboBox, self).focusInEvent(event)
self.lineEdit().selectAll()
def focusOutEvent(self, event):
idx = self.currentIndex()
if idx > -1:
index = self.model().index(idx, 0)
text = index.data(QtCore.Qt.DisplayRole)
if text != self.lineEdit().text():
self.lineEdit().setText(text)
super(FilterComboBox, self).focusOutEvent(event)
def on_completer_activated(self, text):
if text:
index = self.findText(text)