summaryrefslogtreecommitdiffstats
path: root/examples/gui/doc
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2016-09-14 15:01:13 +0200
committerTor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>2016-09-22 16:45:15 +0000
commit0deb0796a42a64930f2d977cd4041c5f1c047187 (patch)
tree3b35aba7908a19987f38f0577da878ddfd199596 /examples/gui/doc
parent524b59b0f51b554ecabbf2663891f9ae1650d122 (diff)
Modernize rasterwindow/openglwindow examples to use requestUpdate()
Change-Id: Ib8d0c42db7343247d0431ea008eb17da9ee98f4d Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Diffstat (limited to 'examples/gui/doc')
-rw-r--r--examples/gui/doc/src/openglwindow.qdoc12
-rw-r--r--examples/gui/doc/src/rasterwindow.qdoc15
2 files changed, 13 insertions, 14 deletions
diff --git a/examples/gui/doc/src/openglwindow.qdoc b/examples/gui/doc/src/openglwindow.qdoc
index e93451c9a5..f283c7cfc0 100644
--- a/examples/gui/doc/src/openglwindow.qdoc
+++ b/examples/gui/doc/src/openglwindow.qdoc
@@ -34,6 +34,9 @@
\image openglwindow-example.png Screenshot of the OpenGLWindow example
+ \note This is a low level example of how to use QWindow with OpenGL.
+ In practice you should consider using the higher level QOpenGLWindow class.
+
\section1 OpenGLWindow Super Class
Our OpenGLWindow class acts as an API which is then subclassed to do the
@@ -70,9 +73,8 @@
\snippet openglwindow/openglwindow.cpp 2
- The renderLater() function simply puts an update request event on
- the event loop, which leads to renderNow() being called once the event
- gets processed.
+ The renderLater() function simply calls QWindow::requestUpdate() to schedule
+ an update for when the system is ready to repaint.
We also call renderNow() when we get an expose event. The exposeEvent() is
the notification to the window that its exposure, meaning visibility, on
@@ -109,11 +111,11 @@
\l {http://www.khronos.org/registry/gles/}{Khronos OpenGL ES API Registry}.
If animation has been enabled with OpenGLWindow::setAnimating(true), we
- call renderLater() to put another update request on the event loop.
+ call renderLater() to schedule another update request.
\snippet openglwindow/openglwindow.cpp 4
- Enabling animation also triggers an update request as shown in the
+ Enabling animation also schedules an update request as shown in the
following code snippet.
\snippet openglwindow/openglwindow.cpp 5
diff --git a/examples/gui/doc/src/rasterwindow.qdoc b/examples/gui/doc/src/rasterwindow.qdoc
index 963d09971d..d276925059 100644
--- a/examples/gui/doc/src/rasterwindow.qdoc
+++ b/examples/gui/doc/src/rasterwindow.qdoc
@@ -143,19 +143,16 @@
\snippet rasterwindow/rasterwindow.cpp 6
We went through a few places where the window needed to repainted
- immediately. There are some cases where this is not desierable,
+ immediately. There are some cases where this is not desirable,
but rather let the application return to the event loop and
- later. We acheive this by posting an even to ourself which will
- then be delivered when the application returns to the \l
- QGuiApplication event loop. To avoid posting new requests when one
- is already pending, we store this state in the \c m_update_pending
- variable.
+ schedule the repaint for later. We achieve this by requesting
+ an update, using QWindow::requestUpdate(), which will then be
+ delivered when the system is ready to repaint.
\snippet rasterwindow/rasterwindow.cpp 7
We reimplement the virtual \l QObject::event() function to handle
- the update event we posted to ourselves. When the event comes in
- we reset the pending update flag and call renderNow() to render
- the window right away.
+ the update event. When the event comes in we call renderNow() to
+ render the window right away.
*/