Showing with 11 additions and 5 deletions.
  1. +1 −1 i18n/qgis_de.ts
  2. +10 −4 src/core/composer/qgsatlascomposition.cpp
2 changes: 1 addition & 1 deletion i18n/qgis_de.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12119,7 +12119,7 @@ Diese Fehler immer ignorieren?</translation>
<message>
<location filename="../src/app/qgisapp.cpp" line="3552"/>
<source>Loading project: %1</source>
<translation>Projektladen: %1</translation>
<translation>Lade Projekt: %1</translation>
</message>
<message>
<location filename="../src/app/qgisapp.cpp" line="3621"/>
Expand Down
14 changes: 10 additions & 4 deletions src/core/composer/qgsatlascomposition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,13 @@ void QgsAtlasComposition::setCoverageLayer( QgsVectorLayer* layer )
QgsExpression::setSpecialColumn( "$numfeatures", QVariant(( int )mFeatureIds.size() ) );

// Grab the first feature so that user can use it to test the style in rules.
QgsFeature fet;
layer->getFeatures().nextFeature( fet );
QgsExpression::setSpecialColumn( "$atlasfeatureid", fet.id() );
QgsExpression::setSpecialColumn( "$atlasgeometry", QVariant::fromValue( *fet.geometry() ) );
if( layer )
{
QgsFeature fet;
layer->getFeatures().nextFeature( fet );
QgsExpression::setSpecialColumn( "$atlasfeatureid", fet.id() );
QgsExpression::setSpecialColumn( "$atlasgeometry", QVariant::fromValue( *fet.geometry() ) );
}

emit coverageLayerChanged( layer );
}
Expand Down Expand Up @@ -663,6 +666,9 @@ void QgsAtlasComposition::setFilenamePattern( const QString& pattern )

void QgsAtlasComposition::updateFilenameExpression()
{
if ( !mCoverageLayer )
return;

const QgsFields& fields = mCoverageLayer->pendingFields();

if ( !mSingleFile && mFilenamePattern.size() > 0 )
Expand Down