QGraphicsSvgItem problem with margins
-
Hello I'am running code of example svgviewer:
http://doc.qt.io/qt-5/qtsvg-svgviewer-example.html
I have got svg file. It look like this (it have got margins)
And it i run code of example svg viewer it look like this:
How can I render svg file with margins?
-
I don't see a difference in your two pictures. Remember that QSvg only supports a subset of the complete svg features - see https://doc.qt.io/qt-5.11/svgrendering.html
-
Hi
Could u link image here ? -
link to svg file
In this page svg file is showing similar to svgViewer-Example but if I open this file by firefox, chrome or other svgViewer app it look like picture 1. -
Hi
Thank for upload.
Looking at
http://svgur.com/s/7XB
There is no build in margins.what is see in svg viewer is just that svg page size is so big that it leaves no empty space around it
as its bigger than window can be.if you scale the image slightly , it looks like
-
@kjnm
Its just due to it being very big default. ( the page size)Try this one
https://www.dropbox.com/s/t3z6yealewmercd/7XB_smaller.svg?dl=0 -
Hi
Seem you just want to paint it using a border.
Not having a border inside image.
That you can easy do when painting it.Like
void MiniSVG::paintEvent(QPaintEvent* ) { QPainter p(this); QSvgRenderer r; // this would normally be a member.. r.load(QString(":/7XB_smaller.svg")); r.render(&p, rect().adjusted(64, 64, -64, -64)); }
sample to play with
https://www.dropbox.com/s/7a9t5ywrpmagxjd/drawsvg.zip?dl=0
if its only this image u need this for, you can also just change page size. ( view box)
that should work too.