Close enough:
scene->setSceneRect( 0, 0, 1000, 1000 ); //you can adjust this as you need
view->setScene(scene);
setCentralWidget(view);
QGraphicsView *view = new QGraphicsView(this);
QGraphicsScene *scene = new QGraphicsScene(view);
scene->setSceneRect( 0, 0, 1000, 1000 ); //you can adjust this as you need
view->setScene(scene);
setCentralWidget(view);
To copy to clipboard, switch view to plain text mode
Next you can start adding items to your scene.
It would be better to make at least the scene a member of the class, because maybe you want to add items to it as a response to user input, etc( in other functions).
Also, if you want to provide custom background/foreground for the view ( a grid or a ruler, for example ), then you need to subclass QGraphicsView and reimplement drawBackground/drawForeground.
Regards
Bookmarks