Skip to content

Commit a4e974a

Browse files
committed
change qsettings in qgsoptions, not qgsapplication
1 parent e879a8b commit a4e974a

File tree

2 files changed

+9
-11
lines changed

2 files changed

+9
-11
lines changed

src/app/qgsoptions.cpp

+3-4
Original file line numberDiff line numberDiff line change
@@ -1076,10 +1076,9 @@ void QgsOptions::saveOptions()
10761076
settings.setValue( "/qgis/enable_anti_aliasing", chkAntiAliasing->isChecked() );
10771077
settings.setValue( "/qgis/enable_render_caching", chkUseRenderCaching->isChecked() );
10781078
settings.setValue( "/qgis/parallel_rendering", chkParallelRendering->isChecked() );
1079-
if ( chkMaxThreads->isChecked() )
1080-
QgsApplication::setMaxThreads( spinMaxThreads->value() );
1081-
else
1082-
QgsApplication::setMaxThreads( -1 );
1079+
int maxThreads = chkMaxThreads->isChecked() ? spinMaxThreads->value() : -1;
1080+
QgsApplication::setMaxThreads( maxThreads );
1081+
settings.setValue( "/qgis/max_threads", maxThreads );
10831082

10841083
settings.setValue( "/qgis/map_update_interval", spinMapUpdateInterval->value() );
10851084
settings.setValue( "/qgis/legendDoubleClickAction", cmbLegendDoubleClickAction->currentIndex() );

src/core/qgsapplication.cpp

+6-7
Original file line numberDiff line numberDiff line change
@@ -1023,25 +1023,24 @@ bool QgsApplication::createDB( QString *errorMessage )
10231023
return true;
10241024
}
10251025

1026-
void QgsApplication::setMaxThreads( int maxThreads )
1027-
{
1028-
qDebug("max threads: %d",maxThreads);
1026+
void QgsApplication::setMaxThreads( int maxThreads )
1027+
{
1028+
QgsDebugMsg( QString( "maxThreads: %1" ).arg( maxThreads ) );
10291029

10301030
// make sure value is between 1 and #cores, if not set to -1 (use #cores)
10311031
// 0 could be used to disable any parallel processing
10321032
if ( maxThreads < 1 || maxThreads > QThread::idealThreadCount() )
1033-
maxThreads = -1;
1033+
maxThreads = -1;
10341034

10351035
// save value
10361036
ABISYM( mMaxThreads ) = maxThreads;
1037-
QSettings().setValue( "/qgis/max_threads", maxThreads );
10381037

10391038
// if -1 use #cores
10401039
if ( maxThreads == -1 )
1041-
maxThreads = QThread::idealThreadCount();
1040+
maxThreads = QThread::idealThreadCount();
10421041

10431042
// set max thread count in QThreadPool
10441043
QThreadPool::globalInstance()->setMaxThreadCount( maxThreads );
1045-
qDebug( "set QThreadPool max thread count to %d", QThreadPool::globalInstance()->maxThreadCount() );
1044+
QgsDebugMsg( QString( "set QThreadPool max thread count to %d" ).arg( QThreadPool::globalInstance()->maxThreadCount() ) );
10461045
}
10471046

0 commit comments

Comments
 (0)