Skip to content
Permalink
Browse files

When the custom projection dialog is blocked from closing due to an i…

…nvalid projection, automatically

select that projection in the list for the user
  • Loading branch information
nyalldawson committed Dec 16, 2019
1 parent aa0b9b0 commit c24f79da26fb017e51edb3f5101793fdf5d877df
Showing with 13 additions and 0 deletions.
  1. +13 −0 src/app/qgscustomprojectiondialog.cpp
@@ -405,6 +405,19 @@ void QgsCustomProjectionDialog::buttonBox_accepted()
CRS.createFromProj4( mCustomCRSparameters[i] );
if ( !CRS.isValid() )
{
// auto select the invalid CRS row
for ( int row = 0; row < leNameList->model()->rowCount(); ++row )
{
if ( leNameList->model()->data( leNameList->model()->index( row, QgisCrsNameColumn ) ).toString() == mCustomCRSnames[i]
&& leNameList->model()->data( leNameList->model()->index( row, QgisCrsParametersColumn ) ).toString() == mCustomCRSparameters[i] )
{
//leNameList_currentItemChanged( leNameList->invisibleRootItem()->child( row ), leNameList->currentItem() );
leNameList->setCurrentItem( leNameList->invisibleRootItem()->child( row ) );
//leNameList->selectionModel()->select( leNameList->model()->index( row, 0 ), QItemSelectionModel::ClearAndSelect | QItemSelectionModel::Rows );
break;
}
}

QMessageBox::warning( this, tr( "Custom Coordinate Reference System" ),
tr( "The proj4 definition of '%1' is not valid." ).arg( mCustomCRSnames[i] ) );
return;

0 comments on commit c24f79d

Please sign in to comment.
You can’t perform that action at this time.