diff options
author | Sean Harmer <sean.harmer@kdab.com> | 2014-11-15 11:40:51 +0000 |
---|---|---|
committer | Sean Harmer <sean.harmer@kdab.com> | 2014-11-17 10:38:22 +0100 |
commit | c5ecabb70c0f0cb25a22bf3742f39648a34d1c3c (patch) | |
tree | e0c788b152d0cb7ec51d0d3e880aa0e286c9fd14 /src/gui/kernel/qevent.cpp | |
parent | 3d575d4845926bd141ff0c14e57427bba79644d0 (diff) |
Send events when platform surfaces are created/about to be destroyed
These synchronously delivered events allow applications to correctly
and conveniently handle native platform surfaces being destroyed. This
is particularly useful when doing rendering on a non-gui thread as it
allows to shutdown rendering before the native surface gets destroyed
from under us.
Task-number: QTBUG-42476
Task-number: QTBUG-42483
Change-Id: I63f41bbdb32f281d0f3b8ec2537eb2b0361f3bb3
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
Diffstat (limited to 'src/gui/kernel/qevent.cpp')
-rw-r--r-- | src/gui/kernel/qevent.cpp | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp index a8539e8013..67c4e3f512 100644 --- a/src/gui/kernel/qevent.cpp +++ b/src/gui/kernel/qevent.cpp @@ -1324,6 +1324,55 @@ QExposeEvent::~QExposeEvent() } /*! + \class QPlatformSurfaceEvent + \since 5.5 + \brief The QPlatformSurfaceEvent class is used to notify about native platform surface events. + \inmodule QtGui + + \ingroup events + + Platform window events are synchronously sent to windows and offscreen surfaces when their + underlying native surfaces are created or are about to be destroyed. + + Applications can respond to these events to know when the underlying platform + surface exists. +*/ + +/*! + \enum QPlatformSurfaceEvent::SurfaceEventType + + This enum describes the type of platform surface event. The possible types are: + + \value SurfaceCreated The underlying native surface has been created + \value SurfaceAboutToBeDestroyed The underlying native surface will be destroyed immediately after this event + + The \c SurfaceAboutToBeDestroyed event type is useful as a means of stopping rendering to + a platform window before it is destroyed. +*/ + +/*! + \fn QPlatformSurfaceEvent::SurfaceEventType QPlatformSurfaceEvent::surfaceEventType() const + + Returns the specific type of platform surface event. +*/ + +/*! + Constructs a platform surface event for the given \a surfaceEventType. +*/ +QPlatformSurfaceEvent::QPlatformSurfaceEvent(SurfaceEventType surfaceEventType) + : QEvent(PlatformSurface) + , m_surfaceEventType(surfaceEventType) +{ +} + +/*! + \internal +*/ +QPlatformSurfaceEvent::~QPlatformSurfaceEvent() +{ +} + +/*! \fn const QRegion &QExposeEvent::region() const Returns the window area that has been exposed. The region is given in local coordinates. |