title: What can block mousePressEvent or Event Filter Mouse Click Events?
body: <p>I can't seem to get any mouse clicks in a QTreeWidget. I have tried...</p>
  
  <ul>
  <li>...overriding mousePressEvent, but it never runs at all. Not even to log a message.</li>
  <li>...using an event filer. It works for everything but mouse clicks.</li>
  <li>...using delegates. Their editor events work fine, but only when over an item, which isn't enough</li>
  <li>...making sure everything is being added to layouts. I used QTCreator and the output is using layout.addWidget(). I am also adding the widget instance to a layout in the main window.</li>
  </ul>
  
  <p>I was able to use the answer to register the widget as an event filter for the QTreeWidget like so:</p>
  
  <pre><code># In __init___
      # self.tree is the QTreeWidget
      self.tree.viewport().installEventFilter(self)
  
  
  
  def eventFilter(self, target, event):
      """ 
      This widget is an event filter for the tree, so this function is triggered 
      automatically
      """
      # Print on right-click
      if (event.type() == QEvent.MouseButtonPress and 
          event.button() == Qt.RightButton):
          print("Right Click")
  
      # Don't block/accept the event
      return False
  </code></pre>