Skip to content

Commit

Permalink
Set html's background to transparent
Browse files Browse the repository at this point in the history
  • Loading branch information
olivierdalang committed Feb 6, 2013
1 parent 8b9522a commit 61f044e
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/core/composer/qgscomposerlabel.cpp
Expand Up @@ -61,6 +61,13 @@ void QgsComposerLabel::paint( QPainter* painter, const QStyleOptionGraphicsItem*
painter->scale( 1.0 / mHtmlUnitsToMM, 1.0 / mHtmlUnitsToMM );

QWebPage* webPage = new QWebPage();

//This makes the background transparent. Found on http://blog.qt.digia.com/blog/2009/06/30/transparent-qwebview-or-qwebpage/
QPalette palette = webPage->palette();
palette.setBrush(QPalette::Base, Qt::transparent);
webPage->setPalette(palette);
//webPage->setAttribute(Qt::WA_OpaquePaintEvent, false); //this does not compile, why ?

webPage->setViewportSize( QSize(painterRect.width() * mHtmlUnitsToMM, painterRect.height() * mHtmlUnitsToMM) );
webPage->mainFrame()->setScrollBarPolicy( Qt::Horizontal, Qt::ScrollBarAlwaysOff );
webPage->mainFrame()->setScrollBarPolicy( Qt::Vertical, Qt::ScrollBarAlwaysOff );
Expand Down

0 comments on commit 61f044e

Please sign in to comment.