Songg
28th February 2016, 14:53
This is how i try to render SVG:
void DialogImageProperies::showSVG(QString sFile){
this->adjustSize();
QSvgRenderer rndr(sFile);
QPixmap px;
QSizeF szSvgF = rndr.defaultSize();
if (szSvgF.width() > szSvgF.height())
{
px = QPixmap(1000, int(qreal(1000 )* szSvgF.height()/szSvgF.width()));
}
else
{
px = QPixmap(int(qreal(1000 )* szSvgF.width()/szSvgF.height()), 1000 );
}
QPainter p(&px);
rndr.render(&p);
ui->wdgBck->setPixmap(px);
this->exec();
}
But as for me, i never notice what is a size of canvas in any created by myself vector-image. So, i think that users also will not predefine correct boundaries.
That is how SVG looks in Inkscape:
11750
That is what i get:
11749
For now i see no way to deal with all it...
void DialogImageProperies::showSVG(QString sFile){
this->adjustSize();
QSvgRenderer rndr(sFile);
QPixmap px;
QSizeF szSvgF = rndr.defaultSize();
if (szSvgF.width() > szSvgF.height())
{
px = QPixmap(1000, int(qreal(1000 )* szSvgF.height()/szSvgF.width()));
}
else
{
px = QPixmap(int(qreal(1000 )* szSvgF.width()/szSvgF.height()), 1000 );
}
QPainter p(&px);
rndr.render(&p);
ui->wdgBck->setPixmap(px);
this->exec();
}
But as for me, i never notice what is a size of canvas in any created by myself vector-image. So, i think that users also will not predefine correct boundaries.
That is how SVG looks in Inkscape:
11750
That is what i get:
11749
For now i see no way to deal with all it...