View Full Version : Opengl problem with graphicsview

28th April 2012, 10:49
Hi everybody...
I've problem using QGLWidget as viewport of QGraphicsView.
I've used two lines of below code:

view->setViewport(new QGLWidget(QGLFormat(QGL::SampleBuffers)));
view->setViewportUpdateMode(QGraphicsView::FullViewportU pdate);

But when i used below code in the scene:

void scene::drawBackground(QPainter *painter,
const QRectF &)
if (painter->paintEngine()->type()
!= QPaintEngine::OpenGL) {
qWarning("OpenGLScene: drawBackground needs a "
"QGLWidget to be set as viewport on the "
"graphics view");

the warning will show, that means the paintEngine is not rendered by OpenGL. My OS is ubuntu and my graphics card is ATI 4350. What's the problem. Could it be hardware problem????

For more info: I'll get following warnnig frequently:
QGLContext::makeCurrent(): Cannot make invalid context current.

Thanks All friends