mirror of
https://github.com/qgis/QGIS.git
synced 2025-11-22 00:14:55 -05:00
fix : allow copying style from an unavailable layer
This commit is contained in:
parent
ce9f519468
commit
2bcb63edc4
@ -1061,7 +1061,7 @@ bool QgsMapLayer::importNamedStyle( QDomDocument &myDocument, QString &myErrorMe
|
||||
{
|
||||
QgsVectorLayer *vl = qobject_cast<QgsVectorLayer *>( this );
|
||||
QgsWkbTypes::GeometryType importLayerGeometryType = static_cast<QgsWkbTypes::GeometryType>( myRoot.firstChildElement( QStringLiteral( "layerGeometryType" ) ).text().toInt() );
|
||||
if ( vl->geometryType() != importLayerGeometryType )
|
||||
if ( importLayerGeometryType != QgsWkbTypes::GeometryType::UnknownGeometry && vl->geometryType() != importLayerGeometryType )
|
||||
{
|
||||
myErrorMessage = tr( "Cannot apply style with symbology to layer with a different geometry type" );
|
||||
return false;
|
||||
|
||||
@ -2800,7 +2800,10 @@ bool QgsVectorLayer::writeStyle( QDomNode &node, QDomDocument &doc, QString &err
|
||||
|
||||
emit writeCustomSymbology( mapLayerNode, doc, errorMessage );
|
||||
|
||||
if ( isSpatial() )
|
||||
// we must try to write the renderer if our geometry type is unknown
|
||||
// as this allows the renderer to be correctly restored even for layers
|
||||
// with broken sources
|
||||
if ( isSpatial() || mWkbType == QgsWkbTypes::Unknown )
|
||||
{
|
||||
if ( categories.testFlag( Symbology ) )
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user