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.

Backported from 49e1ae4
  • Loading branch information
nyalldawson committed Apr 12, 2017
1 parent bf51886 commit 6e0ca9bd00f0272367de26c7211531504d6f333e
Showing with 7 additions and 3 deletions.
  1. +5 −2 src/app/composer/qgscomposermapwidget.cpp
  2. +2 −1 src/app/composer/qgscomposermapwidget.h
@@ -197,6 +197,9 @@ QgsComposerMapWidget::QgsComposerMapWidget( QgsComposerMap* composerMap )
updateGuiElements();
loadGridEntries();
loadOverviewEntries();

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

blockAllSignals( false );
}

@@ -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();
@@ -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();
@@ -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();

0 comments on commit 6e0ca9b

Please sign in to comment.