Skip to content
Permalink
Browse files

Atlas gui: use coverge map's name rather than its id

  • Loading branch information
Hugo Mercier
Hugo Mercier committed Oct 8, 2012
1 parent 8a28d8a commit 6c652a0acd37c3573a3c9f4533b1cb6b06259d77
Showing with 4 additions and 3 deletions.
  1. +4 −3 src/app/composer/qgsatlascompositionwidget.cpp
@@ -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() ) );
}
}

@@ -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;
@@ -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 )
{

0 comments on commit 6c652a0

Please sign in to comment.
You can’t perform that action at this time.