{Forked from http://www.qtcentre.org/forum/f-newb...hics-7728.html}
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
Looking to your code, I remember the code piece in the Qt reference, which says:
scene.addText("Hello, world!");
view.show();
QGraphicsScene scene;
scene.addText("Hello, world!");
QGraphicsView view(&scene);
view.show();
To copy to clipboard, switch view to plain text mode
and I tryed this code, obtaining a well big exception, after a little modify:
scene.addText("Hello, world!");
ui.graphicsviewobj->setScene(&scene);
QGraphicsScene scene;
scene.addText("Hello, world!");
ui.graphicsviewobj->setScene(&scene);
To copy to clipboard, switch view to plain text mode
(ui object has been previously allocated)
Instead of starting a new thread, I ask "why this" here, since I think it is fair in-topic...
Bookmarks