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 {