October 14, 2010

Luca Luca
Ant Farmer
624 posts

Disable svg debug message

 

Hi all,
I have an application that show an svg file in a QWidget (using QSvgRenderer).
It works fine but for some svg file I get some console debug message:

  1. Could not add child element to parent element because the types are incorrect.

This isn’t a problem but I’d like to disable the svg warning message (not all the warning message of the application).

Is it possible?

7 replies

October 14, 2010

Deleted Member # 4a2 Deleted Member # 4a2
Ant Farmer
1481 posts

can you attach a sample svg here to try :) I suspect some unsupported svg element could be causing this. Qt only support SVG tiny 1.2 spec if I remember right

October 14, 2010

Luca Luca
Ant Farmer
624 posts

The svg is created using inkscape and I know the unsupported element. It is a text element:

  1. <text
  2.        id="text2473"
  3.        y="269.28799"
  4.        x="587.35712"
  5.        style="font-size:12px;font-style:normal;font-weight:normal;fill:#4d4d4d;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
  6.        xml:space="preserve"><tspan
  7.          id="tspan2475"
  8.          y="269.28799"
  9.          x="587.35712"
  10.          sodipodi:role="line">PROVA</tspan></text>

Inkscape add the unwanted “tspan” and Qt doesn’t like it. I think this because if I modify the element:

  1. <text
  2.        id="text2473"
  3.        y="269.28799"
  4.        x="587.35712"
  5.        style="font-size:12px;font-style:normal;font-weight:normal;fill:#4d4d4d;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
  6.        xml:space="preserve">PROVA</text>

the warning message disappear.

I only need to disable the warning message.

October 14, 2010

Luca Luca
Ant Farmer
624 posts

I found this:
http://bugreports.qt.nokia.com/browse/QTBUG-11072 [bugreports.qt.nokia.com]

October 14, 2010

Deleted Member # 4a2 Deleted Member # 4a2
Ant Farmer
1481 posts

That warning comes from qsvghandler.cpp

  1. qWarning("Could not add child element to parent element because the types are incorrect.");

You can check the qWarning doc in Assistant for how to supress qWarning output at runtime

October 14, 2010

stuk stuk
Ant Farmer
545 posts

Have you try this in your .pro file?

DEFINES += QT_NO_WARNING_OUTPUT

October 14, 2010

Luca Luca
Ant Farmer
624 posts

stuk wrote:
Have you try this in your .pro file?

DEFINES += QT_NO_WARNING_OUTPUT

I’d like to disable only svg warning output not all application’s warnings.

October 14, 2010

Deleted Member # 4a2 Deleted Member # 4a2
Ant Farmer
1481 posts

then I think you have to comment out that line in qsvghandler.cpp and build your own Qt svg dll :)

I’d rather recommend to modify the svg (use some script if too many svgs are there) and use the Qt SVG module to render them

 
  ‹‹ Qt 4.7 compiling failure with Visual Studio 2010 (win32-msvc2010)      OpenGL 3 Example with Qt 4.7 ? ››

You must log in to post a reply. Not a member yet? Register here!