Skip to content

Commit ce72bde

Browse files
committedMay 23, 2018
[WMS provider] Avoid duplicate format selection radio buttons (fixes #18796)
1 parent 839de2e commit ce72bde

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed
 

‎src/providers/wms/qgswmssourceselect.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,7 @@ bool QgsWMSSourceSelect::populateLayerList( const QgsWmsCapabilities &capabiliti
284284
QVector<QgsWmsLayerProperty> layers = capabilities.supportedLayers();
285285

286286
bool first = true;
287+
QSet<QString> alreadyAddedLabels;
287288
Q_FOREACH ( const QString &encoding, capabilities.supportedImageEncodings() )
288289
{
289290
int id = mMimeMap.value( encoding, -1 );
@@ -292,6 +293,13 @@ bool QgsWMSSourceSelect::populateLayerList( const QgsWmsCapabilities &capabiliti
292293
QgsDebugMsg( QString( "encoding %1 not supported." ).arg( encoding ) );
293294
continue;
294295
}
296+
// Different mime-types can map to the same label. Just add the first
297+
// match to avoid duplicates in the UI
298+
if ( alreadyAddedLabels.contains( mFormats[id].label ) )
299+
{
300+
continue;
301+
}
302+
alreadyAddedLabels.insert( mFormats[id].label );
295303

296304
mImageFormatGroup->button( id )->setVisible( true );
297305
if ( first )

0 commit comments

Comments
 (0)
Please sign in to comment.