title: MousePressEvent in view and items in Qt
body: <p>I have a custom QGraphicsView and a custom QGraphicsItem. I want the Item to handle my click if I click in the item, else I want the click to be handled by the View.</p>
  
  <p>But when I click on the item, the item handles the click. This is ok. But if I click somewhere else the click isn't handled at all. All the code in my classes that have anything to do with mouseEvents is below.</p>
  
  <pre><code>class CustomView : public QGraphicsView
  {
      Q_OBJECT
  
  public:
  
      void mousePressEvent(QGraphicsSceneMouseEvent *event);
  
  };
  
  void CustomView::mousePressEvent(QGraphicsSceneMouseEvent *event){
      cout &lt;&lt; "pressing in view";
  }
  
  class CustomItem : public QGraphicsItem
  {
  public:
      CustomItem(CustomView* widget)
      void mousePressEvent(QGraphicsSceneMouseEvent *event);
  };
  
  CustomItem::CustomItem(CustomView* widget){
      setFlag(ItemIsSelectable);
      setFlag(ItemIsMovable);
  }
  
  void CustomItem::mousePressEvent(QGraphicsSceneMouseEvent *event){
      cout &lt;&lt; "pressing in item";
  }
  </code></pre>
  
  <p>It seems that when I remove the mousePressEvent function from the CustomItem class and change in the CustomView the mousePressEvent function to:</p>
  
  <pre><code>void CustomView::mousePressEvent(QMouseEvent *event){
      cout &lt;&lt; "pressing in view";
  }
  </code></pre>
  
  <p>the CustomView handles all the mouseEvents.</p>
  
  <p>How can I let the CustomItem handles the clicks in the items and the CustomView handle all the other clicks?</p>
  
  <p>Thank you.</p>
  
  <p>EDIT </p>
  
  <p>So now I have changed it to: </p>
  
  <pre><code>    class CustomView : public QGraphicsView
  {
      Q_OBJECT
  
  public:
  
  };
  
   class CustomScene : public QGraphicsScene
  {
  protected:
      void mousePressEvent(QGraphicsSceneMouseEvent *event);
  };
  
  
  void CustomScene::mousePressEvent(QGraphicsSceneMouseEvent *event){
      cout &lt;&lt; "pressing in scene";
  }
  
  class CustomItem : public QGraphicsItem
  {
  public:
      CustomItem(CustomView* widget)
  protected:
      void mousePressEvent(QGraphicsSceneMouseEvent *event);
  };
  
  CustomItem::CustomItem(CustomView* widget){
      setFlag(ItemIsSelectable);
      setFlag(ItemIsMovable);
  }
  
  void CustomItem::mousePressEvent(QGraphicsSceneMouseEvent *event){
      cout &lt;&lt; "pressing in item";
  }
  </code></pre>
  
  <p>A Click in the scene but not in an item get handled by the scene. But clicks in the items
  dont get handled by the items itself, instead it get handled by the scene. Unless if you click 2 times really fast on the items it gets handled by the scene and the item.</p>
  
  <p>Any ideas?</p>