PyQT - event is blocked, when combobox is clicked



  • When i click the Arrow of the Combobox and the menue is shown, events are blocked. Any way of not blocking? I've created a minimal example, which demonstrates the problem. when you click the arrow and press for example some Keys on your keyboard, those are not propagated.

    import sys
    from PyQt4 import QtGui, QtCore

    class Example(QtGui.QMainWindow):
    	
    	def __init__(self):
    		super(Example, self).__init__()
    		
    		self.initUI()
    		
    	def initUI(self):      
    
    
    		self.installEventFilter(self)
    
    		#Help Menue
    		self.help =  QtGui.QComboBox(self)
    		self.help.setObjectName("help")
    		self.help.addItem("testA")
    		self.help.addItem("testB")
    		self.help.addItem("testC")
    		
    		self.statusBar()
    		
    		self.setGeometry(300, 300, 290, 150)
    		self.setWindowTitle('Event sender')
    		self.show()
    
    	def eventFilter(self, source, event):
    		print event
    
    
    
    
    def main():
    	
    	app = QtGui.QApplication(sys.argv)
    	ex = Example()
    	sys.exit(app.exec_())
    
    
    
    
    if __name__ == '__main__':
    	main()

  • Lifetime Qt Champion

    Hi,

    You are missing a return False in your filterEvent function see the C++ documentation for more details


Log in to reply