Fix assert in painting demos when switching to OpenGL.
Fix creation order. The ArthurFrame receives a paint event with OpenGL set to true when the glw-member is still 0. Task-number: QTBUG-26084 Change-Id: Ib4b568d22ae925542e3a775403e4c983ea0b4de5 Reviewed-by: Miikka Heikkinen <miikka.heikkinen@digia.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
This commit is contained in:
parent
e03d1ae953
commit
e454000abc
@ -87,18 +87,21 @@ ArthurFrame::ArthurFrame(QWidget *parent)
|
||||
#ifdef QT_OPENGL_SUPPORT
|
||||
void ArthurFrame::enableOpenGL(bool use_opengl)
|
||||
{
|
||||
m_use_opengl = use_opengl;
|
||||
if (m_use_opengl == use_opengl)
|
||||
return;
|
||||
|
||||
if (!glw) {
|
||||
if (!glw && use_opengl) {
|
||||
glw = new GLWidget(this);
|
||||
glw->setAutoFillBackground(false);
|
||||
glw->disableAutoBufferSwap();
|
||||
QApplication::postEvent(this, new QResizeEvent(size(), size()));
|
||||
}
|
||||
|
||||
m_use_opengl = use_opengl;
|
||||
if (use_opengl) {
|
||||
glw->show();
|
||||
} else {
|
||||
if (glw)
|
||||
glw->hide();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user