mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-15 00:04:00 -04:00
Fix crash when saving map image and dpi != 90
This commit is contained in:
parent
d35bd4abaa
commit
16596599de
@ -92,6 +92,7 @@
|
||||
#include <QtWinExtras/QWinJumpListCategory>
|
||||
#endif
|
||||
|
||||
Q_GUI_EXPORT extern int qt_defaultDpiX();
|
||||
|
||||
//
|
||||
// Mac OS X Includes
|
||||
@ -5784,8 +5785,8 @@ void QgisApp::saveMapAsImage()
|
||||
if ( myFileNameAndFilter.first != QLatin1String( "" ) )
|
||||
{
|
||||
//TODO: GUI
|
||||
int dpi = 90;
|
||||
QSize size = mMapCanvas->size() * ( dpi / 90 );
|
||||
int dpi = qt_defaultDpiX();
|
||||
QSize size = mMapCanvas->size() * ( dpi / qt_defaultDpiX() );
|
||||
|
||||
QgsMapSettings ms = QgsMapSettings();
|
||||
ms.setDestinationCrs( QgsProject::instance()->crs() );
|
||||
|
@ -63,6 +63,9 @@ bool QgsMapRendererTask::run()
|
||||
return false;
|
||||
}
|
||||
|
||||
img.setDotsPerMeterX( 1000 * mMapSettings.outputDpi() / 25.4 );
|
||||
img.setDotsPerMeterY( 1000 * mMapSettings.outputDpi() / 25.4 );
|
||||
|
||||
tempPainter.reset( new QPainter( &img ) );
|
||||
destPainter = tempPainter.get();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user