Skip to content

Commit

Permalink
Atlas gui: use coverge map's name rather than its id
Browse files Browse the repository at this point in the history
  • Loading branch information
Hugo Mercier committed Oct 8, 2012
1 parent 8a28d8a commit 6c652a0
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/app/composer/qgsatlascompositionwidget.cpp
Expand Up @@ -36,7 +36,7 @@ QgsAtlasCompositionWidget::QgsAtlasCompositionWidget( QWidget* parent, QgsCompos
// Only consider vector layers
if ( dynamic_cast<QgsVectorLayer*>(it.value()) )
{
mAtlasCoverageLayerComboBox->insertItem( idx++, it.key(), /* userdata */ qVariantFromValue( (void*)it.value() ) );
mAtlasCoverageLayerComboBox->insertItem( idx++, it.value()->name(), /* userdata */ qVariantFromValue( (void*)it.value() ) );
}
}

Expand Down Expand Up @@ -93,7 +93,8 @@ void QgsAtlasCompositionWidget::onLayerRemoved( QString layerName )
// update the atlas coverage layer combo box
for ( int i = 0; i < mAtlasCoverageLayerComboBox->count(); ++i )
{
if ( mAtlasCoverageLayerComboBox->itemText( i ) == layerName )
const QgsMapLayer* layer = reinterpret_cast<const QgsMapLayer*>( mAtlasCoverageLayerComboBox->itemData( i ).value<void*>() );
if ( layer->id() == layerName )
{
mAtlasCoverageLayerComboBox->removeItem( i );
break;
Expand All @@ -112,7 +113,7 @@ void QgsAtlasCompositionWidget::onLayerAdded( QgsMapLayer* map )
QgsVectorLayer* vectorLayer = dynamic_cast<QgsVectorLayer*>( map );
if ( vectorLayer )
{
mAtlasCoverageLayerComboBox->addItem( map->id(), qVariantFromValue( (void*)map ) );
mAtlasCoverageLayerComboBox->addItem( map->name(), qVariantFromValue( (void*)map ) );
}
if ( mAtlasCoverageLayerComboBox->count() == 1 )
{
Expand Down

0 comments on commit 6c652a0

Please sign in to comment.