PDA

View Full Version : How to render QGraphicsScene/View to FullScreen??



animator
23rd June 2010, 09:51
Dear All,
I have searched the forums and unable to find much info on this one.
I have added a QGraphicsPixmapItem to QGraphicsscene which is set to QGraphicsView. But by using default scene size or setSceneRect im not able to set my scene to full screen. I have even tried with showFullScreen, showMaximized.

My class structure:
Main.cpp --- creating app..
Mercury.cpp -- child of QDialog, creating dialog window here (setting this as parent) and showing scene in the same window. Till now im able to achieve 3/4th of screen and rest i see scrollbar popping up. Even after disabling scrollbar im unable to get scene fullscreen.

Please provide hints on working thorugh this.

aamer4yu
23rd June 2010, 09:54
Full screen for what ? The scene, the view or the item ?

You will need to show view in full screen. Then you can use QGraphicsView::fitInView to show the item in max area.

animator
25th June 2010, 08:14
Thanks for the reply. I need to render QGraphicsscene to fullscreen. I have been able to set 3/4th of screen on trying showFullScreen, showMaximized etc. Please tell me how can i ensure that scene is shown fullscreen.?

aamer4yu
25th June 2010, 09:00
Try this -
Use QGraphicsView::setSceneRect to set the scene area and then show the view in full screen.

animator
25th June 2010, 09:58
Thanks again aamer. But it sets scene to say some 3/4th fullscreen and shows scrollbars if it is bigger. I tried setting scrollbars off but even then screen is 3/4th but navigation happens within that and not extending to fullscreen. Please let me know if anything can be done with this.

animator
28th June 2010, 08:52
Please let me know if anybody has solution for this.

Tito
14th September 2010, 23:18
myScene->setSceneRect(myScene->itemsBoundingRect());
myView->setSceneRect(myScene->sceneRect());