Add debug operators for QOpenGLVersionProfile QOpenGLContext(Group)
Change-Id: I2bf06761bc3a19aa1f0973d9b2f32cec4cbdca0c Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>bb10
parent
6775cfa054
commit
ff8ce00cae
|
|
@ -1676,6 +1676,61 @@ void QOpenGLMultiGroupSharedResource::cleanup(QOpenGLContextGroup *group, QOpenG
|
|||
m_groups.removeOne(group);
|
||||
}
|
||||
|
||||
#ifndef QT_NO_DEBUG_STREAM
|
||||
QDebug operator<<(QDebug debug, const QOpenGLVersionProfile &vp)
|
||||
{
|
||||
QDebugStateSaver saver(debug);
|
||||
debug.nospace();
|
||||
debug << "QOpenGLVersionProfile(";
|
||||
if (vp.isValid()) {
|
||||
debug << vp.version().first << '.' << vp.version().second
|
||||
<< ", profile=" << vp.profile();
|
||||
} else {
|
||||
debug << "invalid";
|
||||
}
|
||||
debug << ')';
|
||||
return debug;
|
||||
}
|
||||
|
||||
QDebug operator<<(QDebug debug, const QOpenGLContext *ctx)
|
||||
{
|
||||
QDebugStateSaver saver(debug);
|
||||
debug.nospace();
|
||||
debug.noquote();
|
||||
debug << "QOpenGLContext(";
|
||||
if (ctx) {
|
||||
debug << static_cast<const void *>(ctx);
|
||||
if (ctx->isValid()) {
|
||||
debug << ", nativeHandle=" << ctx->nativeHandle()
|
||||
<< ", format=" << ctx->format();
|
||||
if (const QSurface *sf = ctx->surface())
|
||||
debug << ", surface=" << sf;
|
||||
if (const QScreen *s = ctx->screen())
|
||||
debug << ", screen=\"" << s->name() << '"';
|
||||
} else {
|
||||
debug << ", invalid";
|
||||
}
|
||||
} else {
|
||||
debug << '0';
|
||||
}
|
||||
debug << ')';
|
||||
return debug;
|
||||
}
|
||||
|
||||
QDebug operator<<(QDebug debug, const QOpenGLContextGroup *cg)
|
||||
{
|
||||
QDebugStateSaver saver(debug);
|
||||
debug.nospace();
|
||||
debug << "QOpenGLContextGroup(";
|
||||
if (cg)
|
||||
debug << cg->shares();
|
||||
else
|
||||
debug << '0';
|
||||
debug << ')';
|
||||
return debug;
|
||||
}
|
||||
#endif // QT_NO_DEBUG_STREAM
|
||||
|
||||
#include "moc_qopenglcontext.cpp"
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
|
|
|||
|
|
@ -69,6 +69,7 @@
|
|||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QDebug;
|
||||
class QOpenGLContextPrivate;
|
||||
class QOpenGLContextGroupPrivate;
|
||||
class QOpenGLFunctions;
|
||||
|
|
@ -249,6 +250,12 @@ private:
|
|||
Q_PRIVATE_SLOT(d_func(), void _q_screenDestroyed(QObject *object))
|
||||
};
|
||||
|
||||
#ifndef QT_NO_DEBUG_STREAM
|
||||
Q_GUI_EXPORT QDebug operator<<(QDebug debug, const QOpenGLVersionProfile &vp);
|
||||
Q_GUI_EXPORT QDebug operator<<(QDebug debug, const QOpenGLContext *ctx);
|
||||
Q_GUI_EXPORT QDebug operator<<(QDebug debug, const QOpenGLContextGroup *cg);
|
||||
#endif // !QT_NO_DEBUG_STREAM
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QT_NO_OPENGL
|
||||
|
|
|
|||
Loading…
Reference in New Issue