Skip to content
Permalink
Browse files
[composer] Use the maximum frame width when setting a html item's con…
…tent width
  • Loading branch information
nyalldawson committed Jul 4, 2014
1 parent 844a9bb commit 176e6c8f752fa954bcb93fdcab5e880bbcc4a09c
Showing with 11 additions and 1 deletion.
  1. +11 −1 src/core/composer/qgscomposerhtml.cpp
@@ -88,7 +88,17 @@ void QgsComposerHtml::loadHtml()
if ( frameCount() < 1 ) return;

QSize contentsSize = mWebPage->mainFrame()->contentsSize();
contentsSize.setWidth( mFrameItems.at( 0 )->boundingRect().width() * mHtmlUnitsToMM );

//find maximum frame width
double maxFrameWidth = 0;
QList<QgsComposerFrame*>::const_iterator frameIt = mFrameItems.constBegin();
for ( ; frameIt != mFrameItems.constEnd(); ++frameIt )
{
maxFrameWidth = qMax( maxFrameWidth, ( *frameIt )->boundingRect().width() );
}
//set content width to match maximum frame width
contentsSize.setWidth( maxFrameWidth * mHtmlUnitsToMM );

mWebPage->setViewportSize( contentsSize );
mWebPage->mainFrame()->setScrollBarPolicy( Qt::Horizontal, Qt::ScrollBarAlwaysOff );
mWebPage->mainFrame()->setScrollBarPolicy( Qt::Vertical, Qt::ScrollBarAlwaysOff );

0 comments on commit 176e6c8

Please sign in to comment.