Skip to content

Commit

Permalink
Check for adding a layer without CRS
Browse files Browse the repository at this point in the history
When (re)defining the geometry type, the default CRS is empty.
There was no check for it, resulting in a layer without a CRS.
That seems not very user friendly. So I choose to check for it and
ask the user if she really wants that.
  • Loading branch information
rduivenvoorde authored and nyalldawson committed Sep 6, 2021
1 parent 5c35539 commit 4f4fbca
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/providers/virtual/qgsvirtuallayersourceselect.cpp
Expand Up @@ -235,6 +235,19 @@ bool QgsVirtualLayerSourceSelect::preFlight()
}
else
{
if ( mGeometryRadio->isChecked() && mCRS->text().isEmpty() )
{
// warning when the geometryRadio is checked, but the user did not set a proper crs
// old implementation did NOT set a crs then...
if ( QMessageBox::Yes == QMessageBox::question( nullptr, tr( "Test Virtual Layer " ), tr( "No CRS defined, are you sure you want to create a layer without a crs?" ), QMessageBox::Yes | QMessageBox::No ) )
{
return true;
}
else
{
return false;
}
}
return true;
}
}
Expand Down

0 comments on commit 4f4fbca

Please sign in to comment.