sub-attaq example: Fix crash with software Open GL
Check whether an Open GL context could be created, else fall back to raster. Task-number: QTBUG-64797 Change-Id: I91bba41b0efca85293a1a4af054842b9f309b126 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
This commit is contained in:
parent
91b35011f5
commit
59343eef7d
@ -84,8 +84,13 @@ MainWindow::MainWindow() : QMainWindow(0)
|
|||||||
view->setAlignment(Qt::AlignLeft | Qt::AlignTop);
|
view->setAlignment(Qt::AlignLeft | Qt::AlignTop);
|
||||||
scene->setupScene(newAction, quitAction);
|
scene->setupScene(newAction, quitAction);
|
||||||
#ifndef QT_NO_OPENGL
|
#ifndef QT_NO_OPENGL
|
||||||
view->setViewport(new QGLWidget(QGLFormat(QGL::SampleBuffers)));
|
QGLWidget *glWidget = new QGLWidget(QGLFormat(QGL::SampleBuffers));
|
||||||
|
if (glWidget->context()->isValid()) {
|
||||||
|
view->setViewport(glWidget);
|
||||||
|
} else {
|
||||||
|
qWarning("Unable to create an Open GL context with sample buffers, not using Open GL.");
|
||||||
|
delete glWidget;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
setCentralWidget(view);
|
setCentralWidget(view);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user