Navigation Menu

Skip to content

Commit

Permalink
Fix composer legend "Filter by Atlas Feature" does not save
Browse files Browse the repository at this point in the history
Fix #16663

(forward port from ecb4c5a)
  • Loading branch information
nyalldawson committed Jun 8, 2017
1 parent 7d9cc13 commit dbdbd15
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/app/composer/qgscomposerlegendwidget.cpp
Expand Up @@ -157,6 +157,7 @@ void QgsComposerLegendWidget::setGuiElements()
mCheckBoxAutoUpdate->setChecked( mLegend->autoUpdateModel() );

mCheckboxResizeContents->setChecked( mLegend->resizeToContents() );
mFilterLegendByAtlasCheckBox->setChecked( mLegend->legendFilterOutAtlas() );

const QgsComposerMap *map = mLegend->composerMap();
mMapComboBox->setItem( map );
Expand Down Expand Up @@ -937,6 +938,7 @@ void QgsComposerLegendWidget::blockAllSignals( bool b )
mWmsLegendHeightSpinBox->blockSignals( b );
mCheckboxResizeContents->blockSignals( b );
mTitleSpaceBottomSpinBox->blockSignals( b );
mFilterLegendByAtlasCheckBox->blockSignals( b );
}

void QgsComposerLegendWidget::selectedChanged( const QModelIndex &current, const QModelIndex &previous )
Expand Down
2 changes: 2 additions & 0 deletions src/core/composer/qgscomposerlegend.cpp 100644 → 100755
Expand Up @@ -406,6 +406,7 @@ bool QgsComposerLegend::writeXml( QDomElement &elem, QDomDocument &doc ) const
{
composerLegendElem.setAttribute( QStringLiteral( "legendFilterByMap" ), QStringLiteral( "1" ) );
}
composerLegendElem.setAttribute( QStringLiteral( "legendFilterByAtlas" ), mFilterOutAtlas ? QStringLiteral("1") : QStringLiteral("0") );

return _writeXml( composerLegendElem, doc );
}
Expand Down Expand Up @@ -479,6 +480,7 @@ bool QgsComposerLegend::readXml( const QDomElement &itemElem, const QDomDocument
{
setComposerMap( mComposition->getComposerMapById( itemElem.attribute( QStringLiteral( "map" ) ).toInt() ) );
}
mFilterOutAtlas = itemElem.attribute( QStringLiteral("legendFilterByAtlas"), QStringLiteral("0") ).toInt();

// QGIS >= 2.6
QDomElement layerTreeElem = itemElem.firstChildElement( QStringLiteral( "layer-tree" ) );
Expand Down

0 comments on commit dbdbd15

Please sign in to comment.