Skip to content

Commit

Permalink
Make absolute image filename more Windows friendly
Browse files Browse the repository at this point in the history
  • Loading branch information
gitlost committed Aug 22, 2019
1 parent 010879f commit 98038e3
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions model/ModelImageObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -538,10 +538,15 @@ namespace glabels
}
else if ( mFilenameNode.isField() )
{
// Look for image file relative to project file 1st then CWD 2nd then absolute 3rd
auto* model = dynamic_cast<Model*>( parent() );
QDir::setSearchPaths( "images", {model->dirPath(), QDir::currentPath(), QDir::rootPath()} );
QString filename = QString("images:") + mFilenameNode.text( record, variables );
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() );
QDir::setSearchPaths( "images", {model->dirPath(), QDir::currentPath()} );
filename = QString("images:") + filename;
}

QImage* image;
QSvgRenderer* svgRenderer;
Expand Down

0 comments on commit 98038e3

Please sign in to comment.