title: Events in QGraphicsView
body: <p>I'm having trouble getting events in <code>QGraphicsView</code> working. I've subclassed <code>QGraphicsView</code> and tried to overload the <code>mousePressEvent</code> and <code>wheelEvent</code>. But neither <code>mousePressEvent</code> nor <code>wheelEvent</code> get called.</p>
  
  <p>Here's my code (Edited a few things now):</p>
  
  <p>Declaration:</p>
  
  <pre><code>#include &lt;QGraphicsView&gt;
  #include &lt;QGraphicsScene&gt;
  class rasImg: public QGraphicsView
  {
  public:
  rasImg(QString file);
  ~rasImg(void);
      initialize();
  QGraphicsView *view;
  QGraphicsScene *scene;
  private:
  virtual void mousePressEvent (QGraphicsSceneMouseEvent  *event);
  virtual void wheelEvent ( QGraphicsSceneMouseEvent  * event );
  }
  </code></pre>
  
  <p>Definition:</p>
  
  <pre><code>#include "rasImg.h"
  void rasImg::initialize()
  {
  view = new QGraphicsView();
  scene = new QGraphicsScene(QRect(0, 0, MaxRow, MaxCol));
  scene-&gt;addText("HELLO");
  scene-&gt;setBackgroundBrush(QColor(100,100,100));
  view-&gt;setDragMode(QGraphicsView::ScrollHandDrag);
  view-&gt;setScene(scene);
  }
  void rasImg::mousePressEvent (QGraphicsSceneMouseEvent  *event)
  {
      qDebug()&lt;&lt;"Mouse released";
      scene-&gt;setBackgroundBrush(QColor(100,0,0));
  }
  void rasImg::wheelEvent ( QGraphicsSceneMouseEvent  * event )
  {
  qDebug()&lt;&lt;"Mouse released";
      scene-&gt;setBackgroundBrush(QColor(100,0,0));
  }
  </code></pre>
  
  <p>So, what am I doing wrong?.<br>Why don't I see a message or background color change when I click the view or use the mouse wheel?</p>