Skip to content

Commit db9a95e

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

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
@@ -232,29 +232,25 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl ) :
232232
}
233233

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

249-
myPaths = mSettings->value( "composer/searchPathsForTemplates", "" ).toString();
250-
if ( !myPaths.isEmpty() )
247+
QStringList templatePaths = QgsApplication::composerTemplatePaths();
248+
if ( !templatePaths.isEmpty() )
251249
{
252-
QStringList myPathList = myPaths.split( '|' );
253-
QStringList::const_iterator pathIt = myPathList.constBegin();
254-
for ( ; pathIt != myPathList.constEnd(); ++pathIt )
250+
Q_FOREACH ( const QString& path, templatePaths )
255251
{
256252
QListWidgetItem* newItem = new QListWidgetItem( mListComposerTemplatePaths );
257-
newItem->setText( *pathIt );
253+
newItem->setText( path );
258254
newItem->setFlags( Qt::ItemIsEditable | Qt::ItemIsEnabled | Qt::ItemIsSelectable );
259255
mListComposerTemplatePaths->addItem( newItem );
260256
}

src/core/qgsapplication.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -696,7 +696,7 @@ QStringList QgsApplication::svgPaths()
696696
//defined by user in options dialog
697697
QSettings settings;
698698
QStringList myPathList;
699-
QString myPaths = settings.value( "svg/searchPathsForSVG", QDir::homePath() ).toString();
699+
QString myPaths = settings.value( "svg/searchPathsForSVG", QString() ).toString();
700700
if ( !myPaths.isEmpty() )
701701
{
702702
myPathList = myPaths.split( '|' );
@@ -715,7 +715,7 @@ QStringList QgsApplication::composerTemplatePaths()
715715
//defined by user in options dialog
716716
QSettings settings;
717717
QStringList myPathList;
718-
QString myPaths = settings.value( "composer/searchPathsForTemplates", QDir::homePath() ).toString();
718+
QString myPaths = settings.value( "composer/searchPathsForTemplates", QString() ).toString();
719719
if ( !myPaths.isEmpty() )
720720
{
721721
myPathList = myPaths.split( '|' );

0 commit comments

Comments
 (0)