I am struggling with another curiosity: my QComboBox should loose focus in this momement, the current Index changed. No big deal (I thought) until I pushed the down-key instead of TAB/Return. The current index then will be increased by 1! I ask me really why, but need a solution for that behaviour as well :)
So I added an event filter and tried to detect it there:
self.ui.CMB_fett.installEventFilter(self)
...
def eventFilter(self, source, event):
if event.type() == QtCore.QEvent.KeyPress:
if source == self.ui.CMB_fett:
if event.key() == QtCore.Qt.Key_Down:
source.currentIndexChanged.disconnect(self.changed_index)
source.setCurrentIndex(source.currentIndex()-1)
source.currentIndexChanged.connect(self.changed_index)
return super().eventFilter(source,event)
Is this really the correct way or the best practise? My bones tell me, that this is really error-prone and nooby ^^