summaryrefslogtreecommitdiffstats
path: root/examples/opengl/qopenglwindow
diff options
context:
space:
mode:
authorAlexander Volkov <a.volkov@rusbitech.ru>2016-12-20 21:37:37 +0300
committerAlexander Volkov <a.volkov@rusbitech.ru>2016-12-22 14:54:55 +0000
commitfb7bfbf18d91d0bd0f1c88ee6043e3dfa7ae9b9e (patch)
tree4afb53415fdd372095f3e9abcb7e9f332d01be40 /examples/opengl/qopenglwindow
parent63e7ff97e960987080e6bda668ba960650dca87f (diff)
examples: Use QOverload to select overloaded signals and slots
We can use QOverload since Qt 5.7 (it depends on Q_COMPILER_VARIADIC_TEMPLATES which is required since Qt 5.7). Use it in the examples to show the best practice. qOverload currently can't be used because it requires c++14. Change-Id: I94a3c0db9d551fe169fa3d19c07ec0b329d5946c Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Diffstat (limited to 'examples/opengl/qopenglwindow')
-rw-r--r--examples/opengl/qopenglwindow/main.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/examples/opengl/qopenglwindow/main.cpp b/examples/opengl/qopenglwindow/main.cpp
index 4287d42d24..4f008b45a6 100644
--- a/examples/opengl/qopenglwindow/main.cpp
+++ b/examples/opengl/qopenglwindow/main.cpp
@@ -173,8 +173,6 @@ void OpenGLWindow::keyPressEvent(QKeyEvent *e)
void OpenGLWindow::setAnimating(bool enabled)
{
- typedef void (QPaintDeviceWindow::*QPaintDeviceWindowVoidSlot)();
-
if (enabled) {
// Animate continuously, throttled by the blocking swapBuffers() call the
// QOpenGLWindow internally executes after each paint. Once that is done
@@ -182,11 +180,11 @@ void OpenGLWindow::setAnimating(bool enabled)
// obviously assumes that the swap interval (see
// QSurfaceFormat::setSwapInterval()) is non-zero.
connect(this, &QOpenGLWindow::frameSwapped,
- this, static_cast<QPaintDeviceWindowVoidSlot>(&QPaintDeviceWindow::update));
+ this, QOverload<>::of(&QPaintDeviceWindow::update));
update();
} else {
disconnect(this, &QOpenGLWindow::frameSwapped,
- this, static_cast<QPaintDeviceWindowVoidSlot>(&QPaintDeviceWindow::update));
+ this, QOverload<>::of(&QPaintDeviceWindow::update));
}
}