Skip to content

Commit fcf85a1

Browse files
committedOct 20, 2018
fix build on Qt <5.6
1 parent dcd3318 commit fcf85a1

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed
 

‎src/gui/qgsmapcanvas.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -691,7 +691,11 @@ QgsRectangle QgsMapCanvas::imageRect( const QImage &img, const QgsMapSettings &m
691691
const QgsMapToPixel &m2p = mapSettings.mapToPixel();
692692
QgsPointXY topLeft = m2p.toMapCoordinates( 0, 0 );
693693
Q_ASSERT( img.devicePixelRatio() == mapSettings.devicePixelRatio() );
694+
#if QT_VERSION >= 0x050600
694695
double res = m2p.mapUnitsPerPixel() / img.devicePixelRatioF();
696+
#else
697+
double res = m2p.mapUnitsPerPixel() / img.devicePixelRatio();
698+
#endif
695699
QgsRectangle rect( topLeft.x(), topLeft.y(), topLeft.x() + img.width()*res, topLeft.y() - img.height()*res );
696700
return rect;
697701
}

‎src/gui/qgsmapcanvasmap.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,20 @@ void QgsMapCanvasMap::paint( QPainter *painter )
6565
int h = std::round( mItemSize.height() ) - 2;
6666

6767
bool scale = false;
68-
if ( mImage.size() != QSize( w, h )*mImage.devicePixelRatioF() )
68+
#if QT_VERSION >= 0x050600
69+
if ( mImage.size() != QSize( w, h ) * mImage.devicePixelRatioF() )
70+
#else
71+
if ( mImage.size() != QSize( w, h ) * mImage.devicePixelRatio() )
72+
#endif
6973
{
7074
QgsDebugMsg( QStringLiteral( "map paint DIFFERENT SIZE: img %1,%2 item %3,%4" )
75+
#if QT_VERSION >= 0x050600
7176
.arg( mImage.width() / mImage.devicePixelRatioF() )
7277
.arg( mImage.height() / mImage.devicePixelRatioF() )
78+
#else
79+
.arg( mImage.width() / mImage.devicePixelRatio() )
80+
.arg( mImage.height() / mImage.devicePixelRatio() )
81+
#endif
7382
.arg( w ).arg( h ) );
7483
// This happens on zoom events when ::paint is called before
7584
// the renderer has completed

0 commit comments

Comments
 (0)
Please sign in to comment.