summaryrefslogtreecommitdiffstats
path: root/examples/opengl
diff options
context:
space:
mode:
authorSamuel Rødal <samuel.rodal@nokia.com>2012-04-19 09:41:48 +0200
committerQt by Nokia <qt-info@nokia.com>2012-04-20 08:14:22 +0200
commit528cb10d5395692d9dd1975e51faca636d87c9e7 (patch)
tree2f7a65cd7b43c97acc7b834ae9ef34ebf92d68f8 /examples/opengl
parent408f3fb2003fca6c2abf4414cef95f05cb1de0a0 (diff)
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 <laszlo.p.agocs@nokia.com>
Diffstat (limited to 'examples/opengl')
-rw-r--r--examples/opengl/hellowindow/hellowindow.cpp13
-rw-r--r--examples/opengl/hellowindow/hellowindow.h2
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);