I can create and display a graphics scene, in main(), like this -
Button *button;
Button *button2;
scene.addPixmap(bg);
button = new Button();
button2 = new Button();
scene.addItem(button);
scene.addItem(button2);
view.setScene(&scene);
view.show();
QGraphicsScene scene(0, 0, WIDTH, HEIGHT);
Button *button;
Button *button2;
QPixmap bg("/../mypix.png");
scene.addPixmap(bg);
button = new Button();
button2 = new Button();
scene.addItem(button);
scene.addItem(button2);
QGraphicsView view;
view.setScene(&scene);
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.
Bookmarks