From 7f00ea90a904ac16dad4ba4edf9d3a992aa42017 Mon Sep 17 00:00:00 2001 From: Nyall Dawson Date: Mon, 19 Aug 2019 09:10:17 +1000 Subject: [PATCH] Don't omit .pdf extension when exporting map to pdf --- src/app/qgsmapsavedialog.cpp | 4 +++- src/ui/qgsmapsavedialog.ui | 13 +++++-------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/app/qgsmapsavedialog.cpp b/src/app/qgsmapsavedialog.cpp index 02bbcdfd5482..feaf15651de0 100644 --- a/src/app/qgsmapsavedialog.cpp +++ b/src/app/qgsmapsavedialog.cpp @@ -43,7 +43,7 @@ #include "qgsmessagebar.h" #include "qgsapplication.h" #include "qgsexpressioncontextutils.h" - +#include "qgsfileutils.h" Q_GUI_EXPORT extern int qt_defaultDpiX(); @@ -467,6 +467,8 @@ void QgsMapSaveDialog::onAccepted() QString fileName = QFileDialog::getSaveFileName( QgisApp::instance(), tr( "Save Map As" ), lastUsedDir, tr( "PDF Format" ) + " (*.pdf *.PDF)" ); if ( !fileName.isEmpty() ) { + fileName = QgsFileUtils::ensureFileNameHasExtension( fileName, QStringList() << QStringLiteral( "pdf" ) ); + settings.setValue( QStringLiteral( "UI/lastSaveAsImageDir" ), QFileInfo( fileName ).absolutePath() ); QgsMapSettings ms = QgsMapSettings(); diff --git a/src/ui/qgsmapsavedialog.ui b/src/ui/qgsmapsavedialog.ui index f835c7ce95d3..07cc9c5c32f6 100644 --- a/src/ui/qgsmapsavedialog.ui +++ b/src/ui/qgsmapsavedialog.ui @@ -15,7 +15,7 @@ - + @@ -43,7 +43,7 @@ - + Create Geospatial PDF (GeoPDF) @@ -105,7 +105,7 @@ 20 - 40 + 133 @@ -158,7 +158,7 @@ - + false @@ -287,16 +287,13 @@ Rasterizing the map is recommended when such effects are used. - + false - - -