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
  • Loading branch information
nyalldawson committed Jun 6, 2017
1 parent 008f385 commit ecb4c5a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/app/composer/qgscomposerlegendwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,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 @@ -922,6 +923,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
3 changes: 3 additions & 0 deletions src/core/composer/qgscomposerlegend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,8 @@ bool QgsComposerLegend::writeXML( QDomElement& elem, QDomDocument & doc ) const
composerLegendElem.setAttribute( "legendFilterByMap", "1" );
}

composerLegendElem.setAttribute( "legendFilterByAtlas", mFilterOutAtlas ? "1" : "0" );

return _writeXML( composerLegendElem, doc );
}

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

QDomElement oldLegendModelElem = itemElem.firstChildElement( "Model" );
if ( !oldLegendModelElem.isNull() )
Expand Down

0 comments on commit ecb4c5a

Please sign in to comment.