summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2018-07-31 12:52:02 +0200
committerTor Arne Vestbø <tor.arne.vestbo@qt.io>2018-07-31 11:26:56 +0000
commit7621bb0f3bba69e0b2849974a335dff4742c8e95 (patch)
tree03b2fa5649565ee6e8c3f4ab4e32f42767fbffc7 /src/gui/kernel
parent0f1f9d42249c6fb1fafde0d6640f983c1f687bb9 (diff)
Add debug logging operator for QPlatformSurface
Change-Id: I2adecf87fa058bf973f4e4eed0a4c002f8359728 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/gui/kernel')
-rw-r--r--src/gui/kernel/qplatformsurface.cpp25
-rw-r--r--src/gui/kernel/qplatformsurface.h9
-rw-r--r--src/gui/kernel/qsurface.h3
3 files changed, 37 insertions, 0 deletions
diff --git a/src/gui/kernel/qplatformsurface.cpp b/src/gui/kernel/qplatformsurface.cpp
index f091c04ebb..fdb2cf567d 100644
--- a/src/gui/kernel/qplatformsurface.cpp
+++ b/src/gui/kernel/qplatformsurface.cpp
@@ -38,6 +38,10 @@
****************************************************************************/
#include "qplatformsurface.h"
+#ifndef QT_NO_DEBUG_STREAM
+#include <QtCore/qdebug.h>
+#include <QtGui/qwindow.h>
+#endif
QT_BEGIN_NAMESPACE
@@ -64,5 +68,26 @@ QPlatformSurface::QPlatformSurface(QSurface *surface) : m_surface(surface)
{
}
+#ifndef QT_NO_DEBUG_STREAM
+Q_GUI_EXPORT QDebug operator<<(QDebug debug, const QPlatformSurface *surface)
+{
+ QDebugStateSaver saver(debug);
+ debug.nospace();
+ debug << "QPlatformSurface(" << (const void *)surface;
+ if (surface) {
+ QSurface *s = surface->surface();
+ auto surfaceClass = s->surfaceClass();
+ debug << ", class=" << surfaceClass;
+ debug << ", type=" << s->surfaceType();
+ if (surfaceClass == QSurface::Window)
+ debug << ", window=" << static_cast<QWindow *>(s);
+ else
+ debug << ", surface=" << s;
+ }
+ debug << ')';
+ return debug;
+}
+#endif // !QT_NO_DEBUG_STREAM
+
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qplatformsurface.h b/src/gui/kernel/qplatformsurface.h
index 76e8767a05..4d8854fb40 100644
--- a/src/gui/kernel/qplatformsurface.h
+++ b/src/gui/kernel/qplatformsurface.h
@@ -58,6 +58,10 @@ QT_BEGIN_NAMESPACE
class QPlatformScreen;
+#ifndef QT_NO_DEBUG_STREAM
+class QDebug;
+#endif
+
class Q_GUI_EXPORT QPlatformSurface
{
public:
@@ -76,6 +80,11 @@ private:
friend class QPlatformOffscreenSurface;
};
+
+#ifndef QT_NO_DEBUG_STREAM
+Q_GUI_EXPORT QDebug operator<<(QDebug debug, const QPlatformSurface *surface);
+#endif
+
QT_END_NAMESPACE
#endif //QPLATFORMSURFACE_H
diff --git a/src/gui/kernel/qsurface.h b/src/gui/kernel/qsurface.h
index e3e5106e3a..521593ea5c 100644
--- a/src/gui/kernel/qsurface.h
+++ b/src/gui/kernel/qsurface.h
@@ -55,11 +55,13 @@ class QSurfacePrivate;
class Q_GUI_EXPORT QSurface
{
+ Q_GADGET
public:
enum SurfaceClass {
Window,
Offscreen
};
+ Q_ENUM(SurfaceClass)
enum SurfaceType {
RasterSurface,
@@ -69,6 +71,7 @@ public:
VulkanSurface,
MetalSurface
};
+ Q_ENUM(SurfaceType)
virtual ~QSurface();