Skip to content

Commit ecb4c5a

Browse files
committed
Fix composer legend "Filter by Atlas Feature" does not save
Fix #16663
1 parent 008f385 commit ecb4c5a

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

src/app/composer/qgscomposerlegendwidget.cpp

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

157157
mCheckboxResizeContents->setChecked( mLegend->resizeToContents() );
158+
mFilterLegendByAtlasCheckBox->setChecked( mLegend->legendFilterOutAtlas() );
158159

159160
const QgsComposerMap* map = mLegend->composerMap();
160161
mMapComboBox->setItem( map );
@@ -922,6 +923,7 @@ void QgsComposerLegendWidget::blockAllSignals( bool b )
922923
mWmsLegendHeightSpinBox->blockSignals( b );
923924
mCheckboxResizeContents->blockSignals( b );
924925
mTitleSpaceBottomSpinBox->blockSignals( b );
926+
mFilterLegendByAtlasCheckBox->blockSignals( b );
925927
}
926928

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

src/core/composer/qgscomposerlegend.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,8 @@ bool QgsComposerLegend::writeXML( QDomElement& elem, QDomDocument & doc ) const
413413
composerLegendElem.setAttribute( "legendFilterByMap", "1" );
414414
}
415415

416+
composerLegendElem.setAttribute( "legendFilterByAtlas", mFilterOutAtlas ? "1" : "0" );
417+
416418
return _writeXML( composerLegendElem, doc );
417419
}
418420

@@ -522,6 +524,7 @@ bool QgsComposerLegend::readXML( const QDomElement& itemElem, const QDomDocument
522524
{
523525
setComposerMap( mComposition->getComposerMapById( itemElem.attribute( "map" ).toInt() ) );
524526
}
527+
mFilterOutAtlas = itemElem.attribute( "legendFilterByAtlas", "0" ).toInt();
525528

526529
QDomElement oldLegendModelElem = itemElem.firstChildElement( "Model" );
527530
if ( !oldLegendModelElem.isNull() )

0 commit comments

Comments
 (0)