Add debug logging operator for QPlatformSurface
Change-Id: I2adecf87fa058bf973f4e4eed0a4c002f8359728 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
This commit is contained in:
parent
0f1f9d4224
commit
7621bb0f3b
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
@ -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();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user