summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Fernengel <harald.fernengel@nokia.com>2010-06-25 14:23:41 (GMT)
committerHarald Fernengel <harald.fernengel@nokia.com>2010-06-25 14:25:14 (GMT)
commitea2ec1a4621bd80b3279ddc67e52cd16084a409b (patch)
treec7911541bea03e63be81de90614cabeff6ad6bb6
parent0fa3175421a3329fe4cb3fb9f79f30807105b02f (diff)
downloadQt-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>
-rw-r--r--src/opengl/qgl.cpp26
-rw-r--r--src/opengl/qgl.h7
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)