Skip to content

Commit 176e6c8

Browse files
committedJul 4, 2014
[composer] Use the maximum frame width when setting a html item's content width
1 parent 844a9bb commit 176e6c8

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed
 

‎src/core/composer/qgscomposerhtml.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,17 @@ void QgsComposerHtml::loadHtml()
8888
if ( frameCount() < 1 ) return;
8989

9090
QSize contentsSize = mWebPage->mainFrame()->contentsSize();
91-
contentsSize.setWidth( mFrameItems.at( 0 )->boundingRect().width() * mHtmlUnitsToMM );
91+
92+
//find maximum frame width
93+
double maxFrameWidth = 0;
94+
QList<QgsComposerFrame*>::const_iterator frameIt = mFrameItems.constBegin();
95+
for ( ; frameIt != mFrameItems.constEnd(); ++frameIt )
96+
{
97+
maxFrameWidth = qMax( maxFrameWidth, ( *frameIt )->boundingRect().width() );
98+
}
99+
//set content width to match maximum frame width
100+
contentsSize.setWidth( maxFrameWidth * mHtmlUnitsToMM );
101+
92102
mWebPage->setViewportSize( contentsSize );
93103
mWebPage->mainFrame()->setScrollBarPolicy( Qt::Horizontal, Qt::ScrollBarAlwaysOff );
94104
mWebPage->mainFrame()->setScrollBarPolicy( Qt::Vertical, Qt::ScrollBarAlwaysOff );

0 commit comments

Comments
 (0)