path: root/src/gui/opengl
diff options
authorMarc Mutz <>2015-10-17 17:48:34 +0200
committerMarc Mutz <>2016-03-04 10:29:08 +0000
commit600529e07a46d8e20f4302dc988125f3fee36ec4 (patch)
treed1ef58c493d6f9dd2521c63ce1f07e04a7aa5658 /src/gui/opengl
parentb6b3803b213787a04dfc7542caeb541a5535d90f (diff)
QtGui: use printf-style qWarning/qDebug where possible (I)
The printf-style version of QDebug expands to a lot less code than the std::ostream-style version. Of course, you pay in type safety (but compilers warn about it these days), you cannot stream complex Qt types and streaming QStrings is awkward, but in many cases you actually improve on readability. But the main reason is that something that's not supposed to be executed under normal operation has no business bloating executable code size. This is not an attempt at converting all qWarnings() to printf-style, only the low-hanging fruit. In this first part, replace qWarning() << "..."; with qWarning("..."); In QTransform shared warning strings. Saves 3KiB in text size on optimized GCC 5.3 AMD64 builds. Change-Id: I142a8020eaab043d78465178192f2c8c6d1cc4f9 Reviewed-by: Friedemann Kleint <> Reviewed-by: Kai Koehne <>
Diffstat (limited to 'src/gui/opengl')
2 files changed, 3 insertions, 3 deletions
diff --git a/src/gui/opengl/qopenglfunctions.cpp b/src/gui/opengl/qopenglfunctions.cpp
index 5b728c9b8d..ea5a8e9252 100644
--- a/src/gui/opengl/qopenglfunctions.cpp
+++ b/src/gui/opengl/qopenglfunctions.cpp
@@ -273,7 +273,7 @@ QOpenGLFunctions::QOpenGLFunctions(QOpenGLContext *context)
if (context && QOpenGLContextGroup::currentContextGroup() == context->shareGroup())
d_ptr = qt_gl_functions(context);
- qWarning() << "QOpenGLFunctions created with non-current context";
+ qWarning("QOpenGLFunctions created with non-current context");
diff --git a/src/gui/opengl/qopenglshaderprogram.cpp b/src/gui/opengl/qopenglshaderprogram.cpp
index 9ac020b64b..bb60139ed6 100644
--- a/src/gui/opengl/qopenglshaderprogram.cpp
+++ b/src/gui/opengl/qopenglshaderprogram.cpp
@@ -250,7 +250,7 @@ bool QOpenGLShaderPrivate::create()
shader = glfuncs->glCreateShader(GL_FRAGMENT_SHADER);
if (!shader) {
- qWarning() << "QOpenGLShader: could not create shader";
+ qWarning("QOpenGLShader: could not create shader");
return false;
shaderGuard = new QOpenGLSharedResourceGuard(context, shader, freeShaderFunc);
@@ -798,7 +798,7 @@ bool QOpenGLShaderProgram::init()
GLuint program = d->glfuncs->glCreateProgram();
if (!program) {
- qWarning() << "QOpenGLShaderProgram: could not create shader program";
+ qWarning("QOpenGLShaderProgram: could not create shader program");
return false;
if (d->programGuard)