Skip to content
Permalink
Browse files

Followup fix for #11006 (spotted by Nyall - thanks)

  • Loading branch information
wonder-sk committed Sep 1, 2014
1 parent d994e0a commit 45d4793c4d5de2322ef632bf208f29785483087f
Showing with 14 additions and 4 deletions.
  1. +14 −4 src/core/composer/qgscomposerlegend.cpp
@@ -63,18 +63,28 @@ void QgsComposerLegend::paint( QPainter* painter, const QStyleOptionGraphicsItem
Q_UNUSED( itemStyle );
Q_UNUSED( pWidget );

if ( !painter )
return;

int dpi = painter->device()->logicalDpiX();
double dotsPerMM = dpi / 25.4;

if ( mComposition )
{
mSettings.setUseAdvancedEffects( mComposition->useAdvancedEffects() );
mSettings.setMapScale( mComposition->mapSettings().scale() );
mSettings.setDpi( painter->device()->logicalDpiX() );
mSettings.setDpi( dpi );
}
if ( mComposerMap )
{
mSettings.setMmPerMapUnit( mComposerMap->mapUnitsToMM() );

if ( !painter )
return;
// use a temporary QgsMapSettings to find out real map scale
QgsMapSettings ms = mComposerMap->composition()->mapSettings();
ms.setOutputSize( QSizeF( mComposerMap->rect().width() * dotsPerMM, mComposerMap->rect().height() * dotsPerMM ).toSize() );
ms.setExtent( *mComposerMap->currentMapExtent() );
ms.setOutputDpi( dpi );
mSettings.setMapScale( ms.scale() );
}

drawBackground( painter );
painter->save();

0 comments on commit 45d4793

Please sign in to comment.
You can’t perform that action at this time.