PDA

View Full Version : GraphicsView in Qt Creator



ProTonS
22nd July 2009, 19:49
Hi guys.

I have problem here.

I am using qt designer to create my Gui. I put a GraphicsView in the center of my QMainWindow and I´ve tried to change the background but I cant, all the box is still white. What is my mistake?


QGraphicsScene scene;
scene.setBackgroundBrush(Qt::blue);
ui.graphicsView->setScene(&scene);
ui.graphicsView->show();

Thanks in advanced

Jorge

wysota
22nd July 2009, 19:59
You have created the scene on the stack so it gets destroyed after running out of scope.

ProTonS
22nd July 2009, 20:02
Now it works!

Thanks a lot, wysota.