Skip to content

Commit 6c652a0

Browse files
author
Hugo Mercier
committedOct 8, 2012
Atlas gui: use coverge map's name rather than its id
1 parent 8a28d8a commit 6c652a0

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed
 

‎src/app/composer/qgsatlascompositionwidget.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ QgsAtlasCompositionWidget::QgsAtlasCompositionWidget( QWidget* parent, QgsCompos
3636
// Only consider vector layers
3737
if ( dynamic_cast<QgsVectorLayer*>(it.value()) )
3838
{
39-
mAtlasCoverageLayerComboBox->insertItem( idx++, it.key(), /* userdata */ qVariantFromValue( (void*)it.value() ) );
39+
mAtlasCoverageLayerComboBox->insertItem( idx++, it.value()->name(), /* userdata */ qVariantFromValue( (void*)it.value() ) );
4040
}
4141
}
4242

@@ -93,7 +93,8 @@ void QgsAtlasCompositionWidget::onLayerRemoved( QString layerName )
9393
// update the atlas coverage layer combo box
9494
for ( int i = 0; i < mAtlasCoverageLayerComboBox->count(); ++i )
9595
{
96-
if ( mAtlasCoverageLayerComboBox->itemText( i ) == layerName )
96+
const QgsMapLayer* layer = reinterpret_cast<const QgsMapLayer*>( mAtlasCoverageLayerComboBox->itemData( i ).value<void*>() );
97+
if ( layer->id() == layerName )
9798
{
9899
mAtlasCoverageLayerComboBox->removeItem( i );
99100
break;
@@ -112,7 +113,7 @@ void QgsAtlasCompositionWidget::onLayerAdded( QgsMapLayer* map )
112113
QgsVectorLayer* vectorLayer = dynamic_cast<QgsVectorLayer*>( map );
113114
if ( vectorLayer )
114115
{
115-
mAtlasCoverageLayerComboBox->addItem( map->id(), qVariantFromValue( (void*)map ) );
116+
mAtlasCoverageLayerComboBox->addItem( map->name(), qVariantFromValue( (void*)map ) );
116117
}
117118
if ( mAtlasCoverageLayerComboBox->count() == 1 )
118119
{

0 commit comments

Comments
 (0)
Please sign in to comment.