diff options
author | Harald Fernengel <harald.fernengel@nokia.com> | 2010-06-25 14:23:41 (GMT) |
---|---|---|
committer | Harald Fernengel <harald.fernengel@nokia.com> | 2010-06-25 14:25:14 (GMT) |
commit | ea2ec1a4621bd80b3279ddc67e52cd16084a409b (patch) | |
tree | c7911541bea03e63be81de90614cabeff6ad6bb6 /src/opengl | |
parent | 0fa3175421a3329fe4cb3fb9f79f30807105b02f (diff) | |
download | Qt-ea2ec1a4621bd80b3279ddc67e52cd16084a409b.zip Qt-ea2ec1a4621bd80b3279ddc67e52cd16084a409b.tar.gz Qt-ea2ec1a4621bd80b3279ddc67e52cd16084a409b.tar.bz2 |
Add qDebug() operator for QGLFormat
Very handy to trace GL issues on a device with broken gdb
Reviewed-by: Trond Kjernåsen <trond.kjernasen@nokia.com>
Diffstat (limited to 'src/opengl')
-rw-r--r-- | src/opengl/qgl.cpp | 26 | ||||
-rw-r--r-- | src/opengl/qgl.h | 7 |
2 files changed, 33 insertions, 0 deletions
diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index b4c85ac..9effb34 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -1521,6 +1521,32 @@ bool operator==(const QGLFormat& a, const QGLFormat& b) && a.d->profile == b.d->profile); } +#ifndef QT_NO_DEBUG_STREAM +QDebug operator<<(QDebug dbg, const QGLFormat &f) +{ + const QGLFormatPrivate * const d = f.d; + + dbg.nospace() << "QGLFormat(" + << "options " << d->opts + << ", plane " << d->pln + << ", depthBufferSize " << d->depthSize + << ", accumBufferSize " << d->accumSize + << ", stencilBufferSize " << d->stencilSize + << ", redBufferSize " << d->redSize + << ", greenBufferSize " << d->greenSize + << ", blueBufferSize " << d->blueSize + << ", alphaBufferSize " << d->alphaSize + << ", samples " << d->numSamples + << ", swapInterval " << d->swapInterval + << ", majorVersion " << d->majorVersion + << ", minorVersion " << d->minorVersion + << ", profile " << d->profile + << ')'; + + return dbg.space(); +} +#endif + /*! Returns false if all the options of the two QGLFormat objects diff --git a/src/opengl/qgl.h b/src/opengl/qgl.h index f0b36f7..f85cad5 100644 --- a/src/opengl/qgl.h +++ b/src/opengl/qgl.h @@ -281,6 +281,9 @@ private: friend Q_OPENGL_EXPORT bool operator==(const QGLFormat&, const QGLFormat&); friend Q_OPENGL_EXPORT bool operator!=(const QGLFormat&, const QGLFormat&); +#ifndef QT_NO_DEBUG_STREAM + friend Q_OPENGL_EXPORT QDebug operator<<(QDebug, const QGLFormat &); +#endif }; Q_DECLARE_OPERATORS_FOR_FLAGS(QGLFormat::OpenGLVersionFlags) @@ -288,6 +291,10 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(QGLFormat::OpenGLVersionFlags) Q_OPENGL_EXPORT bool operator==(const QGLFormat&, const QGLFormat&); Q_OPENGL_EXPORT bool operator!=(const QGLFormat&, const QGLFormat&); +#ifndef QT_NO_DEBUG_STREAM +Q_OPENGL_EXPORT QDebug operator<<(QDebug, const QGLFormat &); +#endif + class Q_OPENGL_EXPORT QGLContext { Q_DECLARE_PRIVATE(QGLContext) |