0000474: Wrong background of SVG pixmaps
git-svn-id: https://free-cad.svn.sourceforge.net/svnroot/free-cad/trunk@5094 e8eeb9e2-ec13-0410-a4a9-efa5cf37419d
This commit is contained in:
parent
e49fc57b21
commit
6001cdcfca
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue
Block a user