Skip to content

Commit

Permalink
[cad] Listen out for CRS changes and enable if appropriate
Browse files Browse the repository at this point in the history
Avoids having to manually switch on and off cad tools after changing
CRS from geographic->metres based
  • Loading branch information
nyalldawson committed Apr 19, 2017
1 parent 3e2d60e commit 1962c54
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/gui/qgsadvanceddigitizingdockwidget.cpp
Expand Up @@ -1210,6 +1210,7 @@ bool QgsAdvancedDigitizingDockWidget::filterKeyPress( QKeyEvent *e )

void QgsAdvancedDigitizingDockWidget::enable()
{
connect( mMapCanvas, &QgsMapCanvas::destinationCrsChanged, this, &QgsAdvancedDigitizingDockWidget::enable, Qt::UniqueConnection );
if ( mMapCanvas->mapSettings().destinationCrs().isGeographic() )
{
mErrorLabel->setText( tr( "CAD tools can not be used on geographic coordinates. Change the coordinates system in the project properties." ) );
Expand All @@ -1236,6 +1237,8 @@ void QgsAdvancedDigitizingDockWidget::enable()

void QgsAdvancedDigitizingDockWidget::disable()
{
disconnect( mMapCanvas, &QgsMapCanvas::destinationCrsChanged, this, &QgsAdvancedDigitizingDockWidget::enable );

mEnableAction->setEnabled( false );
mErrorLabel->setText( tr( "CAD tools are not enabled for the current map tool" ) );
mErrorLabel->show();
Expand Down

0 comments on commit 1962c54

Please sign in to comment.