Skip to content

Commit 61f044e

Browse files
committed
Set html's background to transparent
1 parent 8b9522a commit 61f044e

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/core/composer/qgscomposerlabel.cpp

+7
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,13 @@ void QgsComposerLabel::paint( QPainter* painter, const QStyleOptionGraphicsItem*
6161
painter->scale( 1.0 / mHtmlUnitsToMM, 1.0 / mHtmlUnitsToMM );
6262

6363
QWebPage* webPage = new QWebPage();
64+
65+
//This makes the background transparent. Found on http://blog.qt.digia.com/blog/2009/06/30/transparent-qwebview-or-qwebpage/
66+
QPalette palette = webPage->palette();
67+
palette.setBrush(QPalette::Base, Qt::transparent);
68+
webPage->setPalette(palette);
69+
//webPage->setAttribute(Qt::WA_OpaquePaintEvent, false); //this does not compile, why ?
70+
6471
webPage->setViewportSize( QSize(painterRect.width() * mHtmlUnitsToMM, painterRect.height() * mHtmlUnitsToMM) );
6572
webPage->mainFrame()->setScrollBarPolicy( Qt::Horizontal, Qt::ScrollBarAlwaysOff );
6673
webPage->mainFrame()->setScrollBarPolicy( Qt::Vertical, Qt::ScrollBarAlwaysOff );

0 commit comments

Comments
 (0)