Skip to content

Commit

Permalink
[composer] Use the maximum frame width when setting a html item's con…
Browse files Browse the repository at this point in the history
…tent width
  • Loading branch information
nyalldawson committed Jul 4, 2014
1 parent 844a9bb commit 176e6c8
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/core/composer/qgscomposerhtml.cpp
Expand Up @@ -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 );
Expand Down

0 comments on commit 176e6c8

Please sign in to comment.