Skip to content

Commit

Permalink
Merge pull request #30213 from m-kuhn/no-projection
Browse files Browse the repository at this point in the history
Allow setting the default for new projects to "no projection"
  • Loading branch information
m-kuhn committed Jun 14, 2019
2 parents 5347eb7 + 7bcfb8e commit e3f141c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
9 changes: 8 additions & 1 deletion src/app/qgsoptions.cpp
Expand Up @@ -462,8 +462,15 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl, const QList<QgsOpti
leLayerGlobalCrs->setCrs( mLayerDefaultCrs );

const QString defaultProjectCrs = mSettings->value( QStringLiteral( "/projections/defaultProjectCrs" ), GEO_EPSG_CRS_AUTHID, QgsSettings::App ).toString();
leProjectGlobalCrs->setCrs( QgsCoordinateReferenceSystem( defaultProjectCrs ) );
leProjectGlobalCrs->setOptionVisible( QgsProjectionSelectionWidget::DefaultCrs, false );
leProjectGlobalCrs->setOptionVisible( QgsProjectionSelectionWidget::CrsNotSet, true );
leProjectGlobalCrs->setNotSetText( tr( "No projection (or unknown/non-Earth projection)" ) );
leProjectGlobalCrs->setCrs( QgsCoordinateReferenceSystem( defaultProjectCrs ) );
leProjectGlobalCrs->setMessage(
tr( "<h1>Default projection for new projects</h1>"
"Select a projection that should be used for new projects that are created in QGIS."
) );

const QgsGui::ProjectCrsBehavior projectCrsBehavior = mSettings->enumValue( QStringLiteral( "/projections/newProjectCrsBehavior" ), QgsGui::UseCrsOfFirstLayerAdded, QgsSettings::App );
switch ( projectCrsBehavior )
{
Expand Down
6 changes: 4 additions & 2 deletions src/gui/qgsprojectionselectionwidget.cpp
Expand Up @@ -171,9 +171,11 @@ void QgsProjectionSelectionWidget::selectCrs()
//find out crs id of current proj4 string
QgsProjectionSelectionDialog dlg( this );
dlg.setMessage( mMessage );
if ( mCrs.isValid() )
dlg.setCrs( mCrs );

if ( optionVisible( QgsProjectionSelectionWidget::CrsOption::CrsNotSet ) )
{
dlg.setCrs( mCrs );
dlg.setShowNoProjection( true );
}

if ( dlg.exec() )
Expand Down

0 comments on commit e3f141c

Please sign in to comment.