correctly resize the svg element

svn path=/trunk/KDE/kdelibs/; revision=1136012
This commit is contained in:
Marco Martin 2010-06-08 17:16:01 +00:00
parent 6191e5c9ee
commit a5dc1e58fd

View File

@ -86,14 +86,16 @@ public:
}
//QPainter p(&pm);
if (!svgElement.isNull() && svg->hasElement(svgElement)) {
QSizeF elementSize = svg->elementSize(svgElement);
float scale = pm.width() / qMax(elementSize.width(), elementSize.height());
svg->resize(svg->size() * scale);
if (!svgElement.isEmpty() && svg->hasElement(svgElement)) {
svg->resize();
QSizeF elementSize = svg->elementSize(svgElement);
float scale = q->nativeWidget()->iconSize().width() / qMax(elementSize.width(), elementSize.height());
svg->resize(elementSize * scale);
pm = svg->pixmap(svgElement);
} else {
svg->resize(pm.size());
svg->resize(q->nativeWidget()->iconSize());
pm = svg->pixmap();
}
} else {