Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

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



  • I'm making a Qt program where I use an SVG image using a code similar to this:

    QLabel myLabel;
    myLabel.setPixmap(QPixmap(":/path/to/image.svg"));
    

    The program works fine, except that I get the following warning in the console:

    qt.svg: :\path\to\image.svg:112:20: Could not add child element to parent element because the types are incorrect.
    

    Other than this warning, everything works as it should. The SVG file shows correctly in my Qt program and everything. Also, the SVG file opens correctly in any browser (Chrome, Firefox, Edge) and in Qt Web Engine without any warning.

    I searched the web for this warning and couldn't find anything about what it means.

    What does this warning mean? Is it anything to worry about?



  • Looks like something fishy in your svg file, try uploading it to https://validator.w3.org/#validate-by-upload and select svg as document type to see if it's valid


Log in to reply