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

(cherry picked from commit c24f79d)
  • Loading branch information
nyalldawson committed Dec 16, 2019
1 parent 16fbc0c commit 048f4c4a0fafb704115de460f1ff11252d8b82fc
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 048f4c4

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