diff options
Diffstat (limited to 'examples/opengl')
-rw-r--r-- | examples/opengl/hellowindow/hellowindow.cpp | 13 | ||||
-rw-r--r-- | examples/opengl/hellowindow/hellowindow.h | 2 |
2 files changed, 11 insertions, 4 deletions
diff --git a/examples/opengl/hellowindow/hellowindow.cpp b/examples/opengl/hellowindow/hellowindow.cpp index 489d715166..380ddcc702 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 91267a8ba1..8f294b5ae3 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); |