[Qt-interest] BUG ? : OpenGL-powered QGraphicsView and background of containing widget

Berry Octave octave at octavious.servegame.org
Mon Jun 8 19:35:33 CEST 2009


Le dimanche 07 juin 2009 12:52:24, Oliver Demetz a écrit :
> Hi!
>
> In my main widget I am displaying a QGraphicsView.
> This works fine so far.
>
> I can also set the stylesheet of my main widget to use a qlineargradient
> without getting an error:
>
> MyMainWidget {
>      background: qlineargradient(x1:0,y1:1,x2:1,y2:0, stop:0 #8D8B8B,
> stop:1 #BEBEBE);
> }
>
> As soon as I switch the viewport of the view to a QGLWidget, the
> background-gradient is displayed incorrectly:
>
> mainView.setViewport(new QGLWidget(
>      QGLFormat(QGL::SampleBuffers | QGL::Rgba)));
>
> This leads to the behaviour as in the attached scrrenshot: Left without
> the QGLWidget, right with GL acceleration switched on.
>
> Thanks a lot!
> Oliver

Hi Oliver,

Have you checked the way you clear the OpenGL screen.

By default, OpenGL uses black color.

I suggest you to inherit QGLWidget, redefines initializeGL() with 
glClearColor(255, 255, 255) in its body.

It will just change the default clear color for white (which seems to be what 
you want).

Regards

Octave





More information about the Qt-interest-old mailing list