[5.0.2] Qt SVG - rendering problem with <image> element
-
Hello,
It's the first time I use Qt SVG and I'd like to show a SVG image on my window.
My code:
@QSvgRenderer svg(QString("image.svg"));
QImage *qi = new QImage(76, 147, QImage::Format_ARGB32);
QPainter *painter = new QPainter(qi);
svg.render(painter);QPixmap qpm = QPixmap::fromImage(*qi);
ui->label->setPixmap(qpm);
ui->label->setFixedSize(76, 147);@It works like a charm!
However, when I try to render SVG images with an "<image> element":http://tutorials.jenkov.com/svg/image-element.html inside, it doesn't render well:
!http://img11.hostingpics.net/pics/986948mainwindow.png(SVG with <image> element in my Qt program)!The same SVG renders fine in Inkscape (SVG editor):
!http://img11.hostingpics.net/pics/997759inkscape.png(Same SVG in Inkscape)!You can download the SVG file "here":http://pastebin.com/fsUwMZ3F.
Is it a bug or am I doing something wrong?
-
Up.
-
Qt SVG only implements SVG Tiny specification. It will not work well for all SVG files. And since nobody is eager to fix the module, it is not at all likely that things will improve in the future.
You can use SVG parser from QtWebKit, that one uses full SVG specs, but is harder to use and of course pulls in a big dependency.