void QgsMapLayerStyleManager::readXml( const QDomElement &mgrElement ) { mCurrentStyle = mgrElement.attribute( QStringLiteral( "current" ) ); if ( mCurrentStyle.isEmpty() ) { // For old project made with QGIS 2, we migrate to "default". mCurrentStyle = defaultStyleName(); } mStyles.clear(); QDomElement ch = mgrElement.firstChildElement( QStringLiteral( "map-layer-style" ) ); while ( !ch.isNull() ) { QString name = ch.attribute( QStringLiteral( "name" ) ); if ( name.isEmpty() ) { // For old project made with QGIS 2, we migrate to "default". name = defaultStyleName(); } QgsMapLayerStyle style; style.readXml( ch ); mStyles.insert( name, style ); ch = ch.nextSiblingElement( QStringLiteral( "map-layer-style" ) ); } }
void QgsMapLayerStyleManager::readXml( const QDomElement& mgrElement ) { mCurrentStyle = mgrElement.attribute( "current" ); mStyles.clear(); QDomElement ch = mgrElement.firstChildElement( "map-layer-style" ); while ( !ch.isNull() ) { QString name = ch.attribute( "name" ); QgsMapLayerStyle style; style.readXml( ch ); mStyles.insert( name, style ); ch = ch.nextSiblingElement( "map-layer-style" ); } }