Skip to content
Permalink
Browse files
[composer] Only update map rotation when editing finishes
Avoids multiple map updates when entering values like "90".
Previously the map would be updated at every keystroke,
so  "9" and "90" degree rotations.
  • Loading branch information
nyalldawson committed Apr 12, 2017
1 parent 8637b22 commit 49e1ae40af2ee9cb6c97b5852c9e7632c70c14e6
Showing with 6 additions and 3 deletions.
  1. +4 −2 src/app/composer/qgscomposermapwidget.cpp
  2. +2 −1 src/app/composer/qgscomposermapwidget.h
@@ -119,6 +119,8 @@ QgsComposerMapWidget::QgsComposerMapWidget( QgsComposerMap *composerMap )
loadGridEntries();
loadOverviewEntries();

connect( mMapRotationSpinBox, &QgsDoubleSpinBox::editingFinished, this, &QgsComposerMapWidget::rotationChanged );

blockAllSignals( false );
}

@@ -491,15 +493,15 @@ void QgsComposerMapWidget::on_mScaleLineEdit_editingFinished()
mComposerMap->endCommand();
}

void QgsComposerMapWidget::on_mMapRotationSpinBox_valueChanged( double value )
void QgsComposerMapWidget::rotationChanged()
{
if ( !mComposerMap )
{
return;
}

mComposerMap->beginCommand( tr( "Map rotation changed" ), QgsComposerMergeCommand::ComposerMapRotation );
mComposerMap->setMapRotation( value );
mComposerMap->setMapRotation( mMapRotationSpinBox->value() );
mComposerMap->endCommand();
mComposerMap->cache();
mComposerMap->update();
@@ -39,7 +39,6 @@ class QgsComposerMapWidget: public QgsComposerItemBaseWidget, private Ui::QgsCom
public slots:
void on_mPreviewModeComboBox_activated( int i );
void on_mScaleLineEdit_editingFinished();
void on_mMapRotationSpinBox_valueChanged( double value );
void on_mSetToMapCanvasExtentButton_clicked();
void on_mViewExtentInCanvasButton_clicked();
void on_mUpdatePreviewButton_clicked();
@@ -132,6 +131,8 @@ class QgsComposerMapWidget: public QgsComposerItemBaseWidget, private Ui::QgsCom
//! Blocks / unblocks the signals of all GUI elements
void blockAllSignals( bool b );

void rotationChanged();

void handleChangedFrameDisplay( QgsComposerMapGrid::BorderSide border, const QgsComposerMapGrid::DisplayMode mode );
void handleChangedAnnotationDisplay( QgsComposerMapGrid::BorderSide border, const QString &text );
void handleChangedAnnotationPosition( QgsComposerMapGrid::BorderSide border, const QString &text );

0 comments on commit 49e1ae4

Please sign in to comment.