Skip to content

Commit

Permalink
[WMS provider] Avoid duplicate format selection radio buttons (fixes #…
Browse files Browse the repository at this point in the history
  • Loading branch information
rouault committed May 23, 2018
1 parent 839de2e commit ce72bde
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/providers/wms/qgswmssourceselect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@ bool QgsWMSSourceSelect::populateLayerList( const QgsWmsCapabilities &capabiliti
QVector<QgsWmsLayerProperty> layers = capabilities.supportedLayers();

bool first = true;
QSet<QString> alreadyAddedLabels;
Q_FOREACH ( const QString &encoding, capabilities.supportedImageEncodings() )
{
int id = mMimeMap.value( encoding, -1 );
Expand All @@ -292,6 +293,13 @@ bool QgsWMSSourceSelect::populateLayerList( const QgsWmsCapabilities &capabiliti
QgsDebugMsg( QString( "encoding %1 not supported." ).arg( encoding ) );
continue;
}
// Different mime-types can map to the same label. Just add the first
// match to avoid duplicates in the UI
if ( alreadyAddedLabels.contains( mFormats[id].label ) )
{
continue;
}
alreadyAddedLabels.insert( mFormats[id].label );

mImageFormatGroup->button( id )->setVisible( true );
if ( first )
Expand Down

0 comments on commit ce72bde

Please sign in to comment.