Skip to content
Permalink
Browse files

Fix use of custom params when embedding svg for label background

  • Loading branch information
nyalldawson committed Jul 20, 2018
1 parent 2fc366c commit e4e7b2a48b8d678ad534e468e4741e061055a998
Showing with 13 additions and 3 deletions.
  1. +13 −3 src/gui/qgstextformatwidget.cpp
@@ -1256,11 +1256,21 @@ void QgsTextFormatWidget::updateSvgWidgets( const QString &svgPath )
mShapeSVGPathLineEdit->setText( svgPath );
}

QString resolvedPath = QgsSymbolLayerUtils::svgSymbolNameToPath( svgPath, QgsProject::instance()->pathResolver() );
bool validSVG = QFileInfo::exists( resolvedPath );
QString resolvedPath;
bool validSVG = true;
if ( ! svgPath.startsWith( QStringLiteral( "base64:" ), Qt::CaseInsensitive ) )
{
resolvedPath = QgsSymbolLayerUtils::svgSymbolNameToPath( svgPath, QgsProject::instance()->pathResolver() );
validSVG = QFileInfo::exists( resolvedPath );
}
else
{
resolvedPath = svgPath;
validSVG = true;
}

// draw red text for path field if invalid (path can't be resolved)
mShapeSVGPathLineEdit->setStyleSheet( QString( !validSVG ? "QLineEdit{ color: rgb(225, 0, 0); }" : "" ) );
mShapeSVGPathLineEdit->setStyleSheet( !validSVG ? QStringLiteral( "QLineEdit{ color: rgb(225, 0, 0); }" ) : QString() );
mShapeSVGPathLineEdit->setToolTip( !validSVG ? tr( "File not found" ) : resolvedPath );

QColor fill, stroke;

0 comments on commit e4e7b2a

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