I would like to use SVGs in menus and buttons around a Qt-4.7 application. The images are rendered correctly across linux and windows platforms, however an obnoxious message reading...

couldn't create image from ""

...is printed to the console seemingly as soon as one of these images is loaded or changes state (like highlighting or disabling its container widget). Over the course of the run of the application, many of these lines are printed, leaving a lot of senseless output crufted around reasonable application output.

Poking around the Qt code a bit, this appears to be coming from svg/qsvghandler.cpp:2680 where the line contains the following.

Qt Code:
  1. qDebug()<<"couldn't create image from "<<filename;
To copy to clipboard, switch view to plain text mode 

From the documentation for qDebug, you would think that I could block this by defining QT_NO_DEBUG_OUTPUT at compiletime, but this will only block the application's compiled debug calls, not the one in Qt's SVG library.

So I guess my question is actually two-fold:

  1. As in the title, why is Qt printing this even when rendering SVGs correctly?
  2. Without recompiling Qt or its SVG library, how do I prevent Qt from printing this and crufting the application's output?


I've also posted this question at stackoverflow.