View Full Version : Mystic Problem (QGraphicsView + QGLWidget)

25th April 2008, 19:06
Hey @all,

have a problem where i'am confused. I have a QGraphicsScene Object where i draw my stuff. today i set the viewport of the QGraphicsView as follows:

view = new QGraphicsView(scene);
view->setViewport(new QGLWidget(new QGLContext(QGLFormat::defaultFormat())));

on my primary monitor (vga output) the background is white -> Correct
but when i start my Application with the mouse cursor at my second monitor (digital output) the background is black :confused:

Where can i handle that the background of the QGraphicsView is allways white?

I hope somebody can help me.

King Reagards

25th April 2008, 21:42
u can use drawBackground() to fill the background of the view with white color.

But such prob shudnt be there, can u show us more what u are trying ??

also are your variables properly initialised ? I once had a problem with graphics items where i had not initialised some member. On my pc it used to run correct, but on my collegue's some prob occured.

28th April 2008, 11:39

scene = new DiagramScene(itemMenu, this);
QHBoxLayout *layout = new QHBoxLayout;
view = new QGraphicsView(scene);
QGLWidget *glwidget = new QGLWidget;

The drawing stuff is with QGraphicsPixmapItem and such things.


P.S.: I also noticed that in the company the background is white, but the images (QGraphicsPixmapItem) aren't shown