Skip to content
Permalink
Browse files

Fix qt warning throw by AFS provider due to invalid QString arg usage

And make debug message about unsupported field types more useful
  • Loading branch information
nyalldawson committed Feb 9, 2018
1 parent 8bb297d commit d229ec1fa1de3bb66158b46dbff97303c9a7f9b5
Showing with 9 additions and 4 deletions.
  1. +9 −4 src/providers/arcgisrest/qgsafsprovider.cpp
@@ -97,12 +97,17 @@ QgsAfsProvider::QgsAfsProvider( const QString &uri )
// Read fields
foreach ( const QVariant &fieldData, layerData["fields"].toList() )
{
QVariantMap fieldDataMap = fieldData.toMap();
QString fieldName = fieldDataMap[QStringLiteral( "name" )].toString();
const QVariantMap fieldDataMap = fieldData.toMap();
const QString fieldName = fieldDataMap[QStringLiteral( "name" )].toString();
QVariant::Type type = QgsArcGisRestUtils::mapEsriFieldType( fieldDataMap[QStringLiteral( "type" )].toString() );
if ( fieldName == QLatin1String( "geometry" ) || type == QVariant::Invalid )
if ( fieldName == QLatin1String( "geometry" ) || fieldDataMap[QStringLiteral( "type" )].toString() == QLatin1String( "esriFieldTypeGeometry" ) )
{
QgsDebugMsg( QString( "Skipping unsupported (or possibly geometry) field" ).arg( fieldName ) );
// skip geometry field
continue;
}
if ( type == QVariant::Invalid )
{
QgsDebugMsg( QString( "Skipping unsupported field %1 of type %2" ).arg( fieldName, fieldDataMap[QStringLiteral( "type" )].toString() ) );
continue;
}
QgsField field( fieldName, type, fieldDataMap[QStringLiteral( "type" )].toString(), fieldDataMap[QStringLiteral( "length" )].toInt() );

0 comments on commit d229ec1

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