I can create and display a graphics scene, in main(), like this -

Qt Code:
  1. QGraphicsScene scene(0, 0, WIDTH, HEIGHT);
  2.  
  3. Button *button;
  4. Button *button2;
  5.  
  6. QPixmap bg("/../mypix.png");
  7. scene.addPixmap(bg);
  8.  
  9. button = new Button();
  10. button2 = new Button();
  11.  
  12. scene.addItem(button);
  13. scene.addItem(button2);
  14.  
  15. view.setScene(&scene);
  16. view.show();
To copy to clipboard, switch view to plain text mode 

How would I alter the code to put it in a paintEvent function ? Thanks in advance.