Skip to content

Commit b45e215

Browse files
committed
SLD support: export local svg paths to URI (fix #6792)
1 parent dffae79 commit b45e215

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/core/symbology-ng/qgssymbollayerv2utils.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2176,9 +2176,18 @@ bool QgsSymbolLayerV2Utils::functionFromSldElement( QDomElement &element, QStrin
21762176
void QgsSymbolLayerV2Utils::createOnlineResourceElement( QDomDocument &doc, QDomElement &element,
21772177
QString path, QString format )
21782178
{
2179+
QString relpath = symbolPathToName( path );
2180+
2181+
// convert image path to url
2182+
QUrl url( relpath );
2183+
if ( !url.isValid() || url.scheme().isEmpty() )
2184+
{
2185+
url.setUrl( QUrl::fromLocalFile( relpath ).toString() );
2186+
}
2187+
21792188
QDomElement onlineResourceElem = doc.createElement( "se:OnlineResource" );
21802189
onlineResourceElem.setAttribute( "xlink:type", "simple" );
2181-
onlineResourceElem.setAttribute( "xlink:href", path );
2190+
onlineResourceElem.setAttribute( "xlink:href", url.toString() );
21822191
element.appendChild( onlineResourceElem );
21832192

21842193
QDomElement formatElem = doc.createElement( "se:Format" );

0 commit comments

Comments
 (0)