QSvgWidget not displaying file completely
-
Hello everyone,
I have an SVG file which I want to show in an application window, and for that I am using (trying to) QSvgWidget. I get to see the graphics, but not all of it, as the legend, title and axis labels and markers are all missing.
I am showing both images - the original with all information present and then what is displayed by a QSvgWidget.
Any idea how to solve this problem? At the moment I am not looking at moving away from SVG, so I am primarily interested in fixing this problem, if it's possible.
Thanks.
(The image is generated by the Cairo package in R, if that is of any importance, though I have a feeling that has nothing to do with the problem)_plotViewer = new QSvgWidget(this); _plotViewer->load(graphicsFile);
where graphicsFile is just a QString with the SVG filename.
-
Hi
Qt only supports a subset of SVG. called mini or something like that.
It might be its simply not support if it uses something advanced. -
@mrjj said in QSvgWidget not displaying file completely:
called mini or something like that.
You make me curious. So I looked into the doc. It's called Tiny :)
Qt supports the static features of SVG 1.2 Tiny. ECMA scripts and DOM manipulation are currently not supported.
-
@wavelike
You can use
https://wetransfer.com/
use the ... button
to send as link
and paste link here.
all free. no registration needed.
-
Here it is
https://we.tl/t-DBVDCAfDvm -
Hi
It seems the texts are not real text objects but some sort of path pr letter. (maybe the glyphs)Maybe there is some options in Cairo package that allows to use text object instead ?
Seems other noticed this
https://stackoverflow.com/questions/18258654/r-inkscape-text-labels-in-svg-graphics-exported-from-r-did-not-recognized-as
and https://cran.r-project.org/web/packages/svglite/index.html
can be used to export as text but not sure it fit rest of your use case :) -
@mrjj Yes, that surprised me too, as I wanted to look at the part of the file where the legend/title/other text is located and the search came back empty. My knowledge of graphics files, including SVG, is next to non-existant, so I wasn't exactly shocked. Furthermore, just thinking about something called vector graphics, the ignorant me imagines that the file does not contain letters but relative positions of pixels or whatever... I'd better shut up, because I don't know what I am talking about haha.
-
@wavelike
Hi
Well a hires PNG should also work nicely.
Just for info. SVG is vector which means its not pixels but drawing functions so it can scale
without becoming pixellated. However, Cairo seems to not excatly insert the letters as letter but some form of another drawing thing that Qt cant draw.SVG would look better if you were to print it on really hires printer or in A3 but in other cases, the PNG will look just as fine if you make sure its not lowres.
-
Just in case somebody stumbles upon this thread and also tried to use the Cairo SVG package with QSvgWidget - forget about Cairo as nice as it sometimes could be, as there is an R package ggiraph with a simple function dsvg(filename,...) and it produces a SVG file that is fully supported by Qt.