Skip to content

Commit

Permalink
Render method for composer html
Browse files Browse the repository at this point in the history
  • Loading branch information
mhugent committed Jul 25, 2012
1 parent 4f52d9f commit 5135fe8
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/core/composer/qgscomposerhtml.cpp
Expand Up @@ -46,6 +46,7 @@ void QgsComposerHtml::setUrl( const QUrl& url )
{
qApp->processEvents();
}
mWebPage->setViewportSize( mWebPage->mainFrame()->contentsSize() );
}

void QgsComposerHtml::frameLoaded( bool ok )
Expand All @@ -60,5 +61,15 @@ QSizeF QgsComposerHtml::totalSize() const

void QgsComposerHtml::render( QPainter* p, const QRectF& renderExtent )
{
//soon...
if ( !mWebPage )
{
return;
}

double pixelPerMM = mComposition->printResolution() / 25.4;
double painterScale = 1.0 / ( pixelPerMM / (( double )mImage->dotsPerMeterX() / 1000.0 ) );
painter->save();
painter->scale( painterScale, painterScale );
mWebPage->mainFrame()->render( p, QRegion( renderExtent.left(), renderExtent.top(), renderExtent.width(), renderExtent.height() ) );
painter->restore();
}

0 comments on commit 5135fe8

Please sign in to comment.