From 528cb10d5395692d9dd1975e51faca636d87c9e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Thu, 19 Apr 2012 09:41:48 +0200 Subject: Made hellowindow example respect the expose event. The expose event is sent when the window can start rendering. Change-Id: Ifdfb01a107e3bf665fb7be65802cdaabea4c5a34 Reviewed-by: Laszlo Agocs --- examples/opengl/hellowindow/hellowindow.cpp | 13 +++++++++---- examples/opengl/hellowindow/hellowindow.h | 2 ++ 2 files changed, 11 insertions(+), 4 deletions(-) (limited to 'examples') 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); -- cgit v1.2.3