diff options
author | Tom Cooksey <thomas.cooksey@nokia.com> | 2010-04-29 14:39:06 (GMT) |
---|---|---|
committer | Tom Cooksey <thomas.cooksey@nokia.com> | 2010-04-29 14:51:27 (GMT) |
commit | 702c0546d7d0c39b436bc4a3ec00e24ef454a9b9 (patch) | |
tree | caeee7c38ce8e03c6f56e181f62c2696fb778f25 | |
parent | 35fb88fcd035d43684dfd78b64b04645826d4fac (diff) | |
download | Qt-702c0546d7d0c39b436bc4a3ec00e24ef454a9b9.zip Qt-702c0546d7d0c39b436bc4a3ec00e24ef454a9b9.tar.gz Qt-702c0546d7d0c39b436bc4a3ec00e24ef454a9b9.tar.bz2 |
Add QPlatformGLWidgetSurface::filterEvent
This allows platform integrations to do something special when
the QGLWidget recieves an event. Of particular interest is the
ParentAboutToChange and ParentChange events.
-rw-r--r-- | src/opengl/qgl_lite.cpp | 14 | ||||
-rw-r--r-- | src/opengl/qglplatformintegration_lite.h | 1 |
2 files changed, 15 insertions, 0 deletions
diff --git a/src/opengl/qgl_lite.cpp b/src/opengl/qgl_lite.cpp index fa1439c..0ffda5f 100644 --- a/src/opengl/qgl_lite.cpp +++ b/src/opengl/qgl_lite.cpp @@ -68,6 +68,12 @@ QPlatformGLWidgetSurface::~QPlatformGLWidgetSurface() { } +bool QPlatformGLWidgetSurface::filterEvent(QEvent*) +{ + // By default, return false to allow the event to pass through + return false; +} + bool QGLFormat::hasOpenGL() { @@ -242,6 +248,14 @@ void QGLWidget::setMouseTracking(bool enable) bool QGLWidget::event(QEvent *e) { + Q_D(QGLWidget); + + if (d->wsurf) { + bool eventFiltered = d->wsurf->filterEvent(e); + if (eventFiltered) + return true; + } + return QWidget::event(e); } diff --git a/src/opengl/qglplatformintegration_lite.h b/src/opengl/qglplatformintegration_lite.h index 94d4da0..bec920c 100644 --- a/src/opengl/qglplatformintegration_lite.h +++ b/src/opengl/qglplatformintegration_lite.h @@ -59,6 +59,7 @@ public: virtual bool create(QGLWidget*, QGLFormat&) = 0; virtual void setGeometry(const QRect&) = 0; + virtual bool filterEvent(QEvent*); }; |