diff --git a/src/Gui/BitmapFactory.cpp b/src/Gui/BitmapFactory.cpp index 19a57fe90..21b6dead5 100644 --- a/src/Gui/BitmapFactory.cpp +++ b/src/Gui/BitmapFactory.cpp @@ -281,9 +281,9 @@ QPixmap BitmapFactoryInst::pixmapFromSvg(const QByteArray& contents, const QSize { #ifdef QTWEBKIT QWebView webView; - QPalette pal = webView.palette(); - pal.setColor(QPalette::Background, Qt::transparent); - webView.setPalette(pal); + QPalette pal = webView.palette(); + pal.setColor(QPalette::Background, Qt::transparent); + webView.setPalette(pal); webView.setContent(contents, QString::fromAscii("image/svg+xml")); QString node = QString::fromAscii("document.rootElement.nodeName"); QString root = webView.page()->mainFrame()->evaluateJavaScript(node).toString(); @@ -304,16 +304,17 @@ QPixmap BitmapFactoryInst::pixmapFromSvg(const QByteArray& contents, const QSize QPainter p(&image); #ifdef QTWEBKIT - qreal xs = size.isValid() ? size.width() / ww : 1.0; - qreal ys = size.isValid() ? size.height() / hh : 1.0; - p.scale(xs, ys); - - // the best quality - p.setRenderHint(QPainter::Antialiasing); - p.setRenderHint(QPainter::TextAntialiasing); - p.setRenderHint(QPainter::SmoothPixmapTransform); - webView.page()->mainFrame()->render(&p); -#else + qreal xs = size.isValid() ? size.width() / ww : 1.0; + qreal ys = size.isValid() ? size.height() / hh : 1.0; + p.scale(xs, ys); + + // the best quality + p.setRenderHint(QPainter::Antialiasing); + p.setRenderHint(QPainter::TextAntialiasing); + p.setRenderHint(QPainter::SmoothPixmapTransform); + p.setOpacity(0); // important to keep transparent background + webView.page()->mainFrame()->render(&p); +#else // tmp. disable the report window to suppress some bothering warnings Base::Console().SetEnabledMsgType("ReportOutput", ConsoleMsgType::MsgType_Wrn, false); QSvgRenderer svg(contents);