Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
fix build on Qt <5.6
- Loading branch information
Showing
with
14 additions
and
1 deletion.
-
+4
−0
src/gui/qgsmapcanvas.cpp
-
+10
−1
src/gui/qgsmapcanvasmap.cpp
|
@@ -691,7 +691,11 @@ QgsRectangle QgsMapCanvas::imageRect( const QImage &img, const QgsMapSettings &m |
|
|
const QgsMapToPixel &m2p = mapSettings.mapToPixel(); |
|
|
QgsPointXY topLeft = m2p.toMapCoordinates( 0, 0 ); |
|
|
Q_ASSERT( img.devicePixelRatio() == mapSettings.devicePixelRatio() ); |
|
|
#if QT_VERSION >= 0x050600 |
|
|
double res = m2p.mapUnitsPerPixel() / img.devicePixelRatioF(); |
|
|
#else |
|
|
double res = m2p.mapUnitsPerPixel() / img.devicePixelRatio(); |
|
|
#endif |
|
|
QgsRectangle rect( topLeft.x(), topLeft.y(), topLeft.x() + img.width()*res, topLeft.y() - img.height()*res ); |
|
|
return rect; |
|
|
} |
|
|
|
@@ -65,11 +65,20 @@ void QgsMapCanvasMap::paint( QPainter *painter ) |
|
|
int h = std::round( mItemSize.height() ) - 2; |
|
|
|
|
|
bool scale = false; |
|
|
if ( mImage.size() != QSize( w, h )*mImage.devicePixelRatioF() ) |
|
|
#if QT_VERSION >= 0x050600 |
|
|
if ( mImage.size() != QSize( w, h ) * mImage.devicePixelRatioF() ) |
|
|
#else |
|
|
if ( mImage.size() != QSize( w, h ) * mImage.devicePixelRatio() ) |
|
|
#endif |
|
|
{ |
|
|
QgsDebugMsg( QStringLiteral( "map paint DIFFERENT SIZE: img %1,%2 item %3,%4" ) |
|
|
#if QT_VERSION >= 0x050600 |
|
|
.arg( mImage.width() / mImage.devicePixelRatioF() ) |
|
|
.arg( mImage.height() / mImage.devicePixelRatioF() ) |
|
|
#else |
|
|
.arg( mImage.width() / mImage.devicePixelRatio() ) |
|
|
.arg( mImage.height() / mImage.devicePixelRatio() ) |
|
|
#endif |
|
|
.arg( w ).arg( h ) ); |
|
|
// This happens on zoom events when ::paint is called before |
|
|
// the renderer has completed |
|
|
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session.
You signed out in another tab or window. Reload to refresh your session.