Actually it's the same behaviour as explained in the link in my first post.
So let's say this is my code:
QSvgGenerator generator;
generator.setFileName(file);
generator.
setSize(QSize(200,
200));
generator.
setViewBox(QRect(0,
0,
200,
200));
generator.setResolution(25.4);//setting the resolution
painter.begin(&generator);
painter.drawRect(10,10,100,100);
painter.end();
QSvgGenerator generator;
generator.setFileName(file);
generator.setSize(QSize(200, 200));
generator.setViewBox(QRect(0, 0, 200, 200));
generator.setResolution(25.4);//setting the resolution
QPainter painter;
painter.begin(&generator);
painter.drawRect(10,10,100,100);
painter.end();
To copy to clipboard, switch view to plain text mode
What I get is:
#without setting resolution I get (first lines of the svg file):
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg width="70.5556mm" height="70.5556mm"
viewBox="0 0 200 200"
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg width="70.5556mm" height="70.5556mm"
viewBox="0 0 200 200"
To copy to clipboard, switch view to plain text mode
#when setting resolution to 25.4 I get (first lines of the svg file):
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg width="203.2mm" height="203.2mm"
viewBox="0 0 200 200"
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg width="203.2mm" height="203.2mm"
viewBox="0 0 200 200"
To copy to clipboard, switch view to plain text mode
what I would like to get:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg width="200mm" height="200mm"
viewBox="0 0 200 200"
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg width="200mm" height="200mm"
viewBox="0 0 200 200"
To copy to clipboard, switch view to plain text mode
As I define the size as 200,200 I would also like to get a 200mm,200mm drawing (so my rectangle has the correct size of 100mm,100mm).
Bookmarks