Skip to content
Permalink
Browse files

Fix composer legend "Filter by Atlas Feature" does not save

Fix #16663

(forward port from ecb4c5a)
  • Loading branch information
nyalldawson committed Jun 8, 2017
1 parent 7d9cc13 commit dbdbd1579abbe56696e334b3bbc22df7e53d31d7
Showing with 4 additions and 0 deletions.
  1. +2 −0 src/app/composer/qgscomposerlegendwidget.cpp
  2. +2 −0 src/core/composer/qgscomposerlegend.cpp
@@ -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 );
@@ -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 )
@@ -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 );
}
@@ -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" ) );

0 comments on commit dbdbd15

Please sign in to comment.
You can’t perform that action at this time.