diff options
Diffstat (limited to 'examples/painting')
-rw-r--r-- | examples/painting/shared/arthurwidgets.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/examples/painting/shared/arthurwidgets.cpp b/examples/painting/shared/arthurwidgets.cpp index 695aa984b6..cf790fea3b 100644 --- a/examples/painting/shared/arthurwidgets.cpp +++ b/examples/painting/shared/arthurwidgets.cpp @@ -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(); |