Skip to content

Commit

Permalink
[composer] Only update map rotation when editing finishes
Browse files Browse the repository at this point in the history
Avoids multiple map updates when entering values like "90".
Previously the map would be updated at every keystroke,
so "9" and "90" degree rotations.

Backported from 49e1ae4
  • Loading branch information
nyalldawson committed Apr 12, 2017
1 parent bf51886 commit 6e0ca9b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
7 changes: 5 additions & 2 deletions src/app/composer/qgscomposermapwidget.cpp
Expand Up @@ -197,6 +197,9 @@ QgsComposerMapWidget::QgsComposerMapWidget( QgsComposerMap* composerMap )
updateGuiElements();
loadGridEntries();
loadOverviewEntries();

connect( mMapRotationSpinBox, SIGNAL( editingFinished() ), this, SLOT( rotationChanged() ) );

blockAllSignals( false );
}

Expand Down Expand Up @@ -578,15 +581,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();
Expand Down
3 changes: 2 additions & 1 deletion src/app/composer/qgscomposermapwidget.h
Expand Up @@ -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();
Expand Down Expand Up @@ -160,6 +159,8 @@ class QgsComposerMapWidget: public QgsComposerItemBaseWidget, private Ui::QgsCom

private slots:

void rotationChanged();

/** Sets the GUI elements to the values of mPicture*/
void setGuiElementValues();

Expand Down

0 comments on commit 6e0ca9b

Please sign in to comment.