Make absolute image filename more Windows friendly
This commit is contained in:
@@ -538,10 +538,15 @@ namespace glabels
|
|||||||
}
|
}
|
||||||
else if ( mFilenameNode.isField() )
|
else if ( mFilenameNode.isField() )
|
||||||
{
|
{
|
||||||
// Look for image file relative to project file 1st then CWD 2nd then absolute 3rd
|
QString filename = mFilenameNode.text( record, variables );
|
||||||
|
QFileInfo fileInfo( filename );
|
||||||
|
if ( fileInfo.isRelative() )
|
||||||
|
{
|
||||||
|
// Look for image file relative to project file 1st then CWD 2nd
|
||||||
auto* model = dynamic_cast<Model*>( parent() );
|
auto* model = dynamic_cast<Model*>( parent() );
|
||||||
QDir::setSearchPaths( "images", {model->dirPath(), QDir::currentPath(), QDir::rootPath()} );
|
QDir::setSearchPaths( "images", {model->dirPath(), QDir::currentPath()} );
|
||||||
QString filename = QString("images:") + mFilenameNode.text( record, variables );
|
filename = QString("images:") + filename;
|
||||||
|
}
|
||||||
|
|
||||||
QImage* image;
|
QImage* image;
|
||||||
QSvgRenderer* svgRenderer;
|
QSvgRenderer* svgRenderer;
|
||||||
|
|||||||
Reference in New Issue
Block a user