title: Drawing a rectangle (or anything) on QGraphicsView
body: <p>I'm using QtCreator to build an interface application.</p>
  
  <p>I'm just getting used to Qt and toying around trying to draw stuff on a QtGraphicsView.</p>
  
  <p>Since I created my interface with the editor, I am retrieving my objects in the code like so (please tell me if this is wrong).</p>
  
  <pre><code>this-&gt;m_graphView = this-&gt;findChild&lt;QGraphicsView *&gt;("graphicsView");
  this-&gt;m_graphScene = this-&gt;m_graphView-&gt;scene();
  </code></pre>
  
  <p>I have buttons on the interface and already created slots to react to the clicked event.</p>
  
  <p>I'm just trying to draw something (anything) on the graphics view that is on my MainWindow (geometry : [(10,10), 320x240]).</p>
  
  <p>I've been reading examples online and I can't make anything work.</p>
  
  <p>My current code is as follows : </p>
  
  <pre><code>#include "mainwindow.h"
  #include "ui_mainwindow.h"
  #include &lt;QDebug&gt;
  
  MainWindow::MainWindow(QWidget *parent) :
      QMainWindow(parent),
      ui(new Ui::MainWindow)
  {
      ui-&gt;setupUi(this);
      this-&gt;m_graphView = this-&gt;findChild&lt;QGraphicsView *&gt;("graphicsView");
      this-&gt;m_graphScene = this-&gt;m_graphView-&gt;scene();
  }
  
  MainWindow::~MainWindow()
  {
      delete ui;
  }
  
  void MainWindow::on_btnDown_clicked()
  {
      qDebug() &lt;&lt; "STUB : button DOWN";
  
      m_graphScene-&gt;addLine(0, 0, 42, 42, QPen(QBrush(Qt::black),1));
      m_graphView-&gt;show();
  }
  
  void MainWindow::on_btnLeft_clicked()
  {
      qDebug() &lt;&lt; "STUB : button LEFT";
  }
  
  void MainWindow::on_btnUp_clicked()
  {
      qDebug() &lt;&lt; "STUB : button UP";
  }
  
  void MainWindow::on_btnRight_clicked()
  {
      qDebug() &lt;&lt; "STUB : button RIGHT";
  }
  
  void MainWindow::on_btnShoot_clicked()
  {
      qDebug() &lt;&lt; "STUB : button SHOOT";
  }
  </code></pre>
  
  <p>But annoyingly, it doesn't draw anything and I even get this error when the <code>addLine</code> method is called</p>
  
  <p><code>QGraphicsScene::addItem: item has already been added to this scene</code></p>
  
  <p>What's wrong in my code and/or my ways of doing things?
  I just want to draw something but can't make it, thank you.</p>