Skip to content

Commit dbdbd15

Browse files
committedJun 8, 2017
Fix composer legend "Filter by Atlas Feature" does not save
Fix #16663 (forward port from ecb4c5a)
1 parent 7d9cc13 commit dbdbd15

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed
 

‎src/app/composer/qgscomposerlegendwidget.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ void QgsComposerLegendWidget::setGuiElements()
157157
mCheckBoxAutoUpdate->setChecked( mLegend->autoUpdateModel() );
158158

159159
mCheckboxResizeContents->setChecked( mLegend->resizeToContents() );
160+
mFilterLegendByAtlasCheckBox->setChecked( mLegend->legendFilterOutAtlas() );
160161

161162
const QgsComposerMap *map = mLegend->composerMap();
162163
mMapComboBox->setItem( map );
@@ -937,6 +938,7 @@ void QgsComposerLegendWidget::blockAllSignals( bool b )
937938
mWmsLegendHeightSpinBox->blockSignals( b );
938939
mCheckboxResizeContents->blockSignals( b );
939940
mTitleSpaceBottomSpinBox->blockSignals( b );
941+
mFilterLegendByAtlasCheckBox->blockSignals( b );
940942
}
941943

942944
void QgsComposerLegendWidget::selectedChanged( const QModelIndex &current, const QModelIndex &previous )

‎src/core/composer/qgscomposerlegend.cpp

100644100755
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,7 @@ bool QgsComposerLegend::writeXml( QDomElement &elem, QDomDocument &doc ) const
406406
{
407407
composerLegendElem.setAttribute( QStringLiteral( "legendFilterByMap" ), QStringLiteral( "1" ) );
408408
}
409+
composerLegendElem.setAttribute( QStringLiteral( "legendFilterByAtlas" ), mFilterOutAtlas ? QStringLiteral("1") : QStringLiteral("0") );
409410

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

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

0 commit comments

Comments
 (0)
Please sign in to comment.