diff --git a/examples/opengl/hellowindow/hellowindow.cpp b/examples/opengl/hellowindow/hellowindow.cpp index 489d715166c..380ddcc7021 100644 --- a/examples/opengl/hellowindow/hellowindow.cpp +++ b/examples/opengl/hellowindow/hellowindow.cpp @@ -72,16 +72,21 @@ HelloWindow::HelloWindow(Renderer *renderer) create(); - QTimer *timer = new QTimer(this); - connect(timer, SIGNAL(timeout()), this, SLOT(render())); - timer->start(10); - connect(this, SIGNAL(needRender(QSurface *, const QColor &, const QSize &)), renderer, SLOT(render(QSurface *, const QColor &, const QSize &))); updateColor(); } +void HelloWindow::exposeEvent(QExposeEvent *event) +{ + render(); + + QTimer *timer = new QTimer(this); + connect(timer, SIGNAL(timeout()), this, SLOT(render())); + timer->start(10); +} + void HelloWindow::mousePressEvent(QMouseEvent *) { updateColor(); diff --git a/examples/opengl/hellowindow/hellowindow.h b/examples/opengl/hellowindow/hellowindow.h index 91267a8ba1a..8f294b5ae36 100644 --- a/examples/opengl/hellowindow/hellowindow.h +++ b/examples/opengl/hellowindow/hellowindow.h @@ -92,6 +92,8 @@ public: void updateColor(); + void exposeEvent(QExposeEvent *event); + signals: void needRender(QSurface *surface, const QColor &color, const QSize &viewSize);