Skip to content
Permalink
Browse files

Move map view crs setting to menu

  • Loading branch information
nyalldawson committed Mar 13, 2017
1 parent 843a72e commit 7b28760f906df8057092e867045e227becaf51d5
Showing with 13 additions and 2 deletions.
  1. +12 −1 src/app/qgsmapcanvasdockwidget.cpp
  2. +1 −0 src/app/qgsmapcanvasdockwidget.h
  3. +0 −1 src/ui/qgsmapcanvasdockwidgetbase.ui
@@ -43,7 +43,6 @@ QgsMapCanvasDockWidget::QgsMapCanvasDockWidget( const QString &name, QWidget *pa

mMainWidget->layout()->addWidget( mMapCanvas );

connect( mActionSetCrs, &QAction::triggered, this, &QgsMapCanvasDockWidget::setMapCrs );
connect( mActionSyncView, &QAction::toggled, this, &QgsMapCanvasDockWidget::syncView );

QMenu *menu = new QMenu();
@@ -54,6 +53,11 @@ QgsMapCanvasDockWidget::QgsMapCanvasDockWidget( const QString &name, QWidget *pa
toolButton->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionMapSettings.svg" ) ) );
mToolbar->addWidget( toolButton );

connect( mActionSetCrs, &QAction::triggered, this, &QgsMapCanvasDockWidget::setMapCrs );
connect( mMapCanvas, &QgsMapCanvas::destinationCrsChanged, this, &QgsMapCanvasDockWidget::mapCrsChanged );
mapCrsChanged();
menu->addAction( mActionSetCrs );

QgsMapSettingsAction *settingsAction = new QgsMapSettingsAction( menu );
menu->addAction( settingsAction );
mScaleCombo = settingsAction->scaleCombo();
@@ -188,6 +192,13 @@ void QgsMapCanvasDockWidget::mapExtentChanged()
syncView( true );
}

void QgsMapCanvasDockWidget::mapCrsChanged()
{
mActionSetCrs->setText( tr( "Change Map CRS (%1)" ).arg( mMapCanvas->mapSettings().destinationCrs().isValid() ?
mMapCanvas->mapSettings().destinationCrs().authid() :
tr( "No projection" ) ) );
}

QgsMapSettingsAction::QgsMapSettingsAction( QWidget *parent )
: QWidgetAction( parent )
{
@@ -61,6 +61,7 @@ class APP_EXPORT QgsMapCanvasDockWidget : public QgsDockWidget, private Ui::QgsM
void setMapCrs();
void syncView( bool enabled );
void mapExtentChanged();
void mapCrsChanged();

private:

@@ -41,7 +41,6 @@
<property name="floatable">
<bool>false</bool>
</property>
<addaction name="mActionSetCrs"/>
<addaction name="mActionSyncView"/>
</widget>
</item>

0 comments on commit 7b28760

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