Skip to content
Permalink
Browse files
Allow specifying default WMS image format in settings
  • Loading branch information
manisandro authored and nyalldawson committed Jun 21, 2021
1 parent bbf5d11 commit a8c1be697dd8b55abdff7d8143ce739e4dc7623b
Showing with 6 additions and 1 deletion.
  1. +3 −0 resources/qgis_global_settings.ini
  2. +3 −1 src/providers/wms/qgswmssourceselect.cpp
@@ -45,6 +45,9 @@ connections-xyz\OpenStreetMap\username=
connections-xyz\OpenStreetMap\zmax=19
connections-xyz\OpenStreetMap\zmin=0

# The image format selected by default when adding a WMS, i.e. image/png. If empty, the first available format is used
WMSDefaultFormat=""

# application stylesheet

# Padding (in pixels) to add to toolbar icons, if blank then default padding will be used
@@ -291,6 +291,8 @@ bool QgsWMSSourceSelect::populateLayerList( const QgsWmsCapabilities &capabiliti
const QVector<QgsWmsLayerProperty> layers = capabilities.supportedLayers();
mLayerProperties = layers;

QString defaultEncoding = QgsSettings().value( "qgis/WMSDefaultFormat", "" ).toString();

bool first = true;
QSet<QString> alreadyAddedLabels;
const auto supportedImageEncodings = capabilities.supportedImageEncodings();
@@ -311,7 +313,7 @@ bool QgsWMSSourceSelect::populateLayerList( const QgsWmsCapabilities &capabiliti
alreadyAddedLabels.insert( mFormats[id].label );

mImageFormatGroup->button( id )->setVisible( true );
if ( first )
if ( first || encoding == defaultEncoding )
{
mImageFormatGroup->button( id )->setChecked( true );
first = false;

0 comments on commit a8c1be6

Please sign in to comment.