@@ -59,24 +59,17 @@ void QgsComposerLabel::paint( QPainter* painter, const QStyleOptionGraphicsItem*
59
59
if ( mHtmlState )
60
60
{
61
61
painter->scale ( 1.0 / mHtmlUnitsToMM , 1.0 / mHtmlUnitsToMM );
62
- // painter->translate( 0.0, -renderExtent.top() * mHtmlUnitsToMM );
62
+
63
63
QWebPage* webPage = new QWebPage ();
64
- /*
65
- TODO : http://blog.qt.digia.com/blog/2009/06/30/transparent-qwebview-or-qwebpage/
66
- is it possible ?
67
- */
68
64
webPage->setViewportSize ( QSize (painterRect.width () * mHtmlUnitsToMM , painterRect.height () * mHtmlUnitsToMM ) );
69
65
webPage->mainFrame ()->setScrollBarPolicy ( Qt::Horizontal, Qt::ScrollBarAlwaysOff );
70
66
webPage->mainFrame ()->setScrollBarPolicy ( Qt::Vertical, Qt::ScrollBarAlwaysOff );
71
67
webPage->mainFrame ()->setHtml ( displayText () );
72
- webPage->mainFrame ()->render ( painter );
73
- // webPage->mainFrame()->render( painter, QRegion( painterRect.left(), painterRect.top() * mHtmlUnitsToMM, painterRect.width(), painterRect.height() ) );
74
- // webPage->mainFrame()->render( painter, QRegion( painterRect.left(), painterRect.top() * mHtmlUnitsToMM, painterRect.width() * mHtmlUnitsToMM, painterRect.height() * mHtmlUnitsToMM ) );
75
- // DELETE WEBPAGE ?
68
+ webPage->mainFrame ()->render ( painter );// DELETE WEBPAGE ?
76
69
}
77
70
else
78
71
{
79
- painter->setPen ( QPen ( QColor ( mFontColor ) ) ); // draw all text black
72
+ painter->setPen ( QPen ( QColor ( mFontColor ) ) );
80
73
painter->setFont ( mFont );
81
74
82
75
QFontMetricsF fontSize ( mFont );
@@ -106,6 +99,7 @@ double QgsComposerLabel::htmlUnitsToMM()
106
99
return 1.0 ;
107
100
}
108
101
102
+ // TODO : fix this more precisely so that the label's default text size is the same with or without "display as html"
109
103
return ( mComposition ->printResolution () / 96.0 ); // webkit seems to assume a standard dpi of 96
110
104
}
111
105
0 commit comments