Skip to content

Commit

Permalink
Followup 64949d : fix failure to load provider-provided style
Browse files Browse the repository at this point in the history
  • Loading branch information
nirvn committed Nov 14, 2019
1 parent 6180c59 commit 7cb9e04
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions src/core/qgsvectorlayer.cpp
Expand Up @@ -4677,20 +4677,26 @@ QString QgsVectorLayer::loadNamedStyle( const QString &theURI, bool &resultFlag,
{
QgsDataSourceUri dsUri( theURI );
QString returnMessage;
QString qml, errorMsg;
if ( !loadFromLocalDB && mDataProvider && mDataProvider->isSaveAndLoadStyleToDatabaseSupported() )
{
QString qml, errorMsg;
qml = QgsProviderRegistry::instance()->loadStyle( mProviderKey, mDataSource, errorMsg );
if ( !qml.isEmpty() )
{
QDomDocument myDocument( QStringLiteral( "qgis" ) );
myDocument.setContent( qml );
resultFlag = importNamedStyle( myDocument, errorMsg );
returnMessage = QObject::tr( "Loaded from Provider" );
}
}
returnMessage = QgsMapLayer::loadNamedStyle( theURI, resultFlag, categories );
emit styleLoaded( categories );
if ( !qml.isEmpty() )
{
QDomDocument myDocument( QStringLiteral( "qgis" ) );
myDocument.setContent( qml );
resultFlag = importNamedStyle( myDocument, errorMsg );
returnMessage = QObject::tr( "Loaded from Provider" );
}
else
{
returnMessage = QgsMapLayer::loadNamedStyle( theURI, resultFlag, categories );
}

if ( resultFlag )
emit styleLoaded( categories );

return returnMessage;
}

Expand Down

0 comments on commit 7cb9e04

Please sign in to comment.