From a5dc1e58fd60f232a647fab3de228a2f7b589aeb Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Tue, 8 Jun 2010 17:16:01 +0000 Subject: [PATCH] correctly resize the svg element svn path=/trunk/KDE/kdelibs/; revision=1136012 --- widgets/pushbutton.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/widgets/pushbutton.cpp b/widgets/pushbutton.cpp index 4f89d229b..f9ce08f15 100644 --- a/widgets/pushbutton.cpp +++ b/widgets/pushbutton.cpp @@ -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 {