Skip to content

Commit 50cada4

Browse files
committed
Fix home dir being added as default svg and template path
Fixes #14662, #14652, #14883
1 parent f0c8fe6 commit 50cada4

File tree

2 files changed

+10
-14
lines changed

2 files changed

+10
-14
lines changed

src/app/qgsoptions.cpp

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -235,29 +235,25 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl )
235235
}
236236

237237
//local directories to search when looking for an SVG with a given basename
238-
myPaths = mSettings->value( "svg/searchPathsForSVG", QDir::homePath() ).toString();
239-
if ( !myPaths.isEmpty() )
238+
QStringList svgPaths = QgsApplication::svgPaths();
239+
if ( !svgPaths.isEmpty() )
240240
{
241-
QStringList myPathList = myPaths.split( '|' );
242-
QStringList::const_iterator pathIt = myPathList.constBegin();
243-
for ( ; pathIt != myPathList.constEnd(); ++pathIt )
241+
Q_FOREACH ( const QString& path, svgPaths )
244242
{
245243
QListWidgetItem* newItem = new QListWidgetItem( mListSVGPaths );
246-
newItem->setText( *pathIt );
244+
newItem->setText( path );
247245
newItem->setFlags( Qt::ItemIsEditable | Qt::ItemIsEnabled | Qt::ItemIsSelectable );
248246
mListSVGPaths->addItem( newItem );
249247
}
250248
}
251249

252-
myPaths = mSettings->value( "composer/searchPathsForTemplates", "" ).toString();
253-
if ( !myPaths.isEmpty() )
250+
QStringList templatePaths = QgsApplication::composerTemplatePaths();
251+
if ( !templatePaths.isEmpty() )
254252
{
255-
QStringList myPathList = myPaths.split( '|' );
256-
QStringList::const_iterator pathIt = myPathList.constBegin();
257-
for ( ; pathIt != myPathList.constEnd(); ++pathIt )
253+
Q_FOREACH ( const QString& path, templatePaths )
258254
{
259255
QListWidgetItem* newItem = new QListWidgetItem( mListComposerTemplatePaths );
260-
newItem->setText( *pathIt );
256+
newItem->setText( path );
261257
newItem->setFlags( Qt::ItemIsEditable | Qt::ItemIsEnabled | Qt::ItemIsSelectable );
262258
mListComposerTemplatePaths->addItem( newItem );
263259
}

src/core/qgsapplication.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -706,7 +706,7 @@ QStringList QgsApplication::svgPaths()
706706
//defined by user in options dialog
707707
QSettings settings;
708708
QStringList myPathList;
709-
QString myPaths = settings.value( "svg/searchPathsForSVG", QDir::homePath() ).toString();
709+
QString myPaths = settings.value( "svg/searchPathsForSVG", QString() ).toString();
710710
if ( !myPaths.isEmpty() )
711711
{
712712
myPathList = myPaths.split( '|' );
@@ -725,7 +725,7 @@ QStringList QgsApplication::composerTemplatePaths()
725725
//defined by user in options dialog
726726
QSettings settings;
727727
QStringList myPathList;
728-
QString myPaths = settings.value( "composer/searchPathsForTemplates", QDir::homePath() ).toString();
728+
QString myPaths = settings.value( "composer/searchPathsForTemplates", QString() ).toString();
729729
if ( !myPaths.isEmpty() )
730730
{
731731
myPathList = myPaths.split( '|' );

0 commit comments

Comments
 (0)