Skip to content

Commit

Permalink
[composer] Block signals from controls when loading atlas widget
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed May 29, 2014
1 parent 49eba8c commit d104045
Showing 1 changed file with 30 additions and 9 deletions.
39 changes: 30 additions & 9 deletions src/app/composer/qgsatlascompositionwidget.cpp
Expand Up @@ -31,7 +31,7 @@ QgsAtlasCompositionWidget::QgsAtlasCompositionWidget( QWidget* parent, QgsCompos
setupUi( this );

mAtlasCoverageLayerComboBox->setFilters( QgsMapLayerProxyModel::HasGeometry );
mAtlasSortFeatureKeyComboBox->setLayer( mAtlasCoverageLayerComboBox->currentLayer() );

connect( mAtlasCoverageLayerComboBox, SIGNAL( layerChanged( QgsMapLayer* ) ), mAtlasSortFeatureKeyComboBox, SLOT( setLayer( QgsMapLayer* ) ) );
connect( mAtlasCoverageLayerComboBox, SIGNAL( layerChanged( QgsMapLayer* ) ), this, SLOT( changeCoverageLayer( QgsMapLayer* ) ) );
connect( mAtlasSortFeatureKeyComboBox, SIGNAL( fieldChanged( QString ) ), this, SLOT( changesSortFeatureField( QString ) ) );
Expand Down Expand Up @@ -286,30 +286,51 @@ void QgsAtlasCompositionWidget::on_mAtlasSortFeatureDirectionButton_clicked()

void QgsAtlasCompositionWidget::updateGuiElements()
{
blockAllSignals( true );
QgsAtlasComposition* atlasMap = &mComposition->atlasComposition();
if ( atlasMap->enabled() )
{
mUseAtlasCheckBox->setCheckState( Qt::Checked );
}
else
{
mUseAtlasCheckBox->setCheckState( Qt::Unchecked );
}

mUseAtlasCheckBox->setCheckState( atlasMap->enabled() ? Qt::Checked : Qt::Unchecked );
mConfigurationGroup->setEnabled( atlasMap->enabled() );
mOutputGroup->setEnabled( atlasMap->enabled() );

mAtlasCoverageLayerComboBox->setLayer( atlasMap->coverageLayer() );

mAtlasSortFeatureKeyComboBox->setLayer( atlasMap->coverageLayer() );
mAtlasSortFeatureKeyComboBox->setField( atlasMap->sortKeyAttributeName() );

mAtlasFilenamePatternEdit->setText( atlasMap->filenamePattern() );
mAtlasHideCoverageCheckBox->setCheckState( atlasMap->hideCoverage() ? Qt::Checked : Qt::Unchecked );

mAtlasSingleFileCheckBox->setCheckState( atlasMap->singleFile() ? Qt::Checked : Qt::Unchecked );
mAtlasFilenamePatternEdit->setEnabled( !atlasMap->singleFile() );
mAtlasFilenameExpressionButton->setEnabled( atlasMap->singleFile() );

mAtlasSortFeatureCheckBox->setCheckState( atlasMap->sortFeatures() ? Qt::Checked : Qt::Unchecked );
mAtlasSortFeatureDirectionButton->setEnabled( atlasMap->sortFeatures() );
mAtlasSortFeatureKeyComboBox->setEnabled( atlasMap->sortFeatures() );

mAtlasSortFeatureDirectionButton->setArrowType( atlasMap->sortAscending() ? Qt::UpArrow : Qt::DownArrow );
mAtlasFeatureFilterEdit->setText( atlasMap->featureFilter() );

mAtlasFeatureFilterCheckBox->setCheckState( atlasMap->filterFeatures() ? Qt::Checked : Qt::Unchecked );
mAtlasFeatureFilterEdit->setEnabled( atlasMap->filterFeatures() );
mAtlasFeatureFilterButton->setEnabled( atlasMap->filterFeatures() );

blockAllSignals( false );
}

void QgsAtlasCompositionWidget::blockAllSignals( bool b )
{
mUseAtlasCheckBox->blockSignals( b );
mConfigurationGroup->blockSignals( b );
mOutputGroup->blockSignals( b );
mAtlasCoverageLayerComboBox->blockSignals( b );
mAtlasSortFeatureKeyComboBox->blockSignals( b );
mAtlasFilenamePatternEdit->blockSignals( b );
mAtlasHideCoverageCheckBox->blockSignals( b );
mAtlasSingleFileCheckBox->blockSignals( b );
mAtlasSortFeatureCheckBox->blockSignals( b );
mAtlasSortFeatureDirectionButton->blockSignals( b );
mAtlasFeatureFilterEdit->blockSignals( b );
mAtlasFeatureFilterCheckBox->blockSignals( b );
}

0 comments on commit d104045

Please sign in to comment.