Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. PyQT - event is blocked, when combobox is clicked
Forum Updated to NodeBB v4.3 + New Features

PyQT - event is blocked, when combobox is clicked

Scheduled Pinned Locked Moved General and Desktop
qcomboboxevent
2 Posts 2 Posters 2.3k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Schiho
    wrote on last edited by
    #1

    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()
    
    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

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

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved