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,19 +87,22 @@ 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 {
|
||||
glw->hide();
|
||||
if (glw)
|
||||
glw->hide();
|
||||
}
|
||||
|
||||
update();
|
||||
|
Loading…
Reference in New Issue
Block a user