Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix use of custom params when embedding svg for label background
  • Loading branch information
nyalldawson committed Jul 23, 2018
1 parent 2fc366c commit e4e7b2a
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/gui/qgstextformatwidget.cpp
Expand Up @@ -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;
Expand Down

0 comments on commit e4e7b2a

Please sign in to comment.