title: QGraphicsScene, QGraphicsView and QVBoxLayout() problem
body: <p>Greetings everyone,</p>
  
  <p>Every time I run it seems Qt Creator just stop working, when I commented out the line <code>//mainWindow = new MainWindow();</code> But if the line is not commented out<code>, MainWindow</code> will keep appearing many times. Also to check, is the structure of the <code>QGraphicsScene</code>, <code>QGraphicsView</code> and <code>QVBoxLayout</code> correct because I cant seem to make the view to appear when MainWindow is being called in main.cpp. </p>
  
  <p>thanks :)</p>
  
  <pre><code>MainWindow::MainWindow(QWidget *parent) :
  QMainWindow(parent), keydown_left(false), keydown_right(false),scene(NULL), view(NULL)
  {
      qDebug("MainWindow");
      //mainWindow = new MainWindow();
      //qsrand(QTime(0,0,0).secsTo(QTime::currentTime()));
      scene = new QGraphicsScene(mainWindow);
      view = new QGraphicsView(scene, mainWindow);
  
      scene-&gt;setSceneRect(-300, 0, 640, 360);
      scene-&gt;setItemIndexMethod(QGraphicsScene::NoIndex);
      Egg *egg = new Egg();
  
      QVBoxLayout *layout = new QVBoxLayout();
  
      for (int i = 0; i &lt; ObjCount; ++i) {
          FlyingObj *Fo= new FlyingObj();
          Fo-&gt;setPos(::sin((i * 6.28) / ObjCount) * 500,
                     ::cos((i * 6.28) / ObjCount) * 500);
          scene-&gt;addItem(Fo);
      }
      egg-&gt;setPos((640-64)/2, 100);//16 - 2*16
      scene-&gt;addItem(egg);
  
  
      view-&gt;setRenderHint(QPainter::Antialiasing);
      view-&gt;setBackgroundBrush(QPixmap(":/bg.jpg"));
      //view-&gt;setViewportUpdateMode(QGraphicsView::BoundingRectViewportUpdate);
      view-&gt;setDragMode(QGraphicsView::NoDrag);
      view-&gt;setWindowTitle(QT_TRANSLATE_NOOP(QGraphicsView, "Egg game"));
      view-&gt;resize(640, 360);
      QObject::connect(scene, SIGNAL(keyPressEvent(QKeyEvent)), this, SLOT(keyPressEvent(QKeyEvent)));
      view-&gt;setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
      view-&gt;setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
      view-&gt;setFrameStyle(QFrame::NoFrame);
      view-&gt;setFocusPolicy(Qt::NoFocus);
      view-&gt;setCacheMode(QGraphicsView::CacheBackground);
      view-&gt;showFullScreen();
  
      layout-&gt;addWidget(view);
      QWidget *w = new QWidget();
      w-&gt;setLayout(layout);
  }
  </code></pre>