133void QgsSettingsRegistryCore::migrateOldSettings()
156#if defined( HAVE_QTSERIALPORT )
157 QgsGpsDetector::settingsGpsStopBits->copyValueFromKey( QStringLiteral(
"core/gps/stop_bits" ) );
158 QgsGpsDetector::settingsGpsFlowControl->copyValueFromKey( QStringLiteral(
"core/gps/flow_control" ) );
159 QgsGpsDetector::settingsGpsDataBits->copyValueFromKey( QStringLiteral(
"core/gps/data_bits" ) );
160 QgsGpsDetector::settingsGpsParity->copyValueFromKey( QStringLiteral(
"core/gps/parity" ) );
173 if ( settings->contains( QStringLiteral(
"Map/scales" ) ) )
175 const QStringList oldScales = settings->value( QStringLiteral(
"Map/scales" ) ).toStringList();
176 if ( ! oldScales.isEmpty() && !oldScales.at( 0 ).isEmpty() )
177 settings->setValue( QStringLiteral(
"Map/scales" ), oldScales.join(
',' ) );
187 const QStringList oldScales = settings->value( QStringLiteral(
"map/scales" ) ).toStringList();
188 if ( ! oldScales.isEmpty() && !oldScales.at( 0 ).isEmpty() )
192 QStringList actualScales;
193 for (
const QString &element : oldScales )
195 actualScales << element.split(
"," );
200 else if ( settings->contains( QStringLiteral(
"Map/scales" ) ) )
208 settingsDigitizingLineColor->
copyValueFromKeys( QStringLiteral(
"qgis/digitizing/line_color_red" ), QStringLiteral(
"qgis/digitizing/line_color_green" ), QStringLiteral(
"qgis/digitizing/line_color_blue" ), QStringLiteral(
"qgis/digitizing/line_color_alpha" ) );
209 settingsDigitizingFillColor->
copyValueFromKeys( QStringLiteral(
"qgis/digitizing/fill_color_red" ), QStringLiteral(
"qgis/digitizing/fill_color_green" ), QStringLiteral(
"qgis/digitizing/fill_color_blue" ), QStringLiteral(
"qgis/digitizing/fill_color_alpha" ) );
214 QString name = setting->name();
223 name = QStringLiteral(
"reuseLastValues" );
227 name.replace(
'-',
'_' );
229 setting->copyValueFromKey( QString(
"qgis/digitizing/%1" ).arg( name ) );
235 settings->beginGroup( QStringLiteral(
"gui/locator_filters" ) );
236 const QStringList childKeys = settings->childKeys();
237 settings->endGroup();
238 for (
const QString &childKey : childKeys )
240 if ( childKey.startsWith( QLatin1String(
"enabled" ) ) )
242 QString filter = childKey;
243 filter.remove( QStringLiteral(
"enabled_" ) );
252 const QStringList services = {QStringLiteral(
"WMS" ), QStringLiteral(
"WFS" ), QStringLiteral(
"WCS" )};
253 for (
const QString &service : services )
256 settings.
beginGroup( QStringLiteral(
"qgis/connections-%1" ).arg( service.toLower() ) );
257 const QStringList connections = settings.
childGroups();
258 if ( connections.count() == 0 )
260 for (
const QString &connection : connections )
262 if ( settings.
value( QStringLiteral(
"%1/url" ).arg( connection ) ).toString().isEmpty() )
283 settings.
remove( QStringLiteral(
"http-header" ) );
291 if ( settings.
contains( QStringLiteral(
"selected" ) ) )
298 settings.
beginGroup( QStringLiteral(
"qgis/connections-vector-tile" ) );
299 const QStringList connections = settings.
childGroups();
300 for (
const QString &connection : connections )
302 if ( settings.
value( QStringLiteral(
"%1/url" ).arg( connection ) ).toString().isEmpty() )
305 QgsVectorTileProviderConnection::settingsUrl->copyValueFromKey( QStringLiteral(
"qgis/connections-vector-tile/%1/url" ), {connection}, true );
306 QgsVectorTileProviderConnection::settingsZmin->copyValueFromKey( QStringLiteral(
"qgis/connections-vector-tile/%1/zmin" ), {connection}, true );
307 QgsVectorTileProviderConnection::settingsZmax->copyValueFromKey( QStringLiteral(
"qgis/connections-vector-tile/%1/zmax" ), {connection}, true );
308 QgsVectorTileProviderConnection::settingsAuthcfg->copyValueFromKey( QStringLiteral(
"qgis/connections-vector-tile/%1/authcfg" ), {connection}, true );
309 QgsVectorTileProviderConnection::settingsUsername->copyValueFromKey( QStringLiteral(
"qgis/connections-vector-tile/%1/username" ), {connection}, true );
310 QgsVectorTileProviderConnection::settingsPassword->copyValueFromKey( QStringLiteral(
"qgis/connections-vector-tile/%1/password" ), {connection}, true );
311 QgsVectorTileProviderConnection::settingsStyleUrl->copyValueFromKey( QStringLiteral(
"qgis/connections-vector-tile/%1/styleUrl" ), {connection}, true );
312 QgsVectorTileProviderConnection::settingsServiceType->copyValueFromKey( QStringLiteral(
"qgis/connections-vector-tile/%1/serviceType" ), {connection}, true );
315 QgsVectorTileProviderConnection::settingsHeaders->setValue(
QgsHttpHeaders( settings ).headers(), connection );
316 settings.
remove( QStringLiteral(
"http-header" ) );
325 settings.
beginGroup( QStringLiteral(
"qgis/connections-xyz" ) );
326 const QStringList connections = settings.
childGroups();
327 for (
const QString &connection : connections )
329 if ( settings.
value( QStringLiteral(
"%1/url" ).arg( connection ) ).toString().isEmpty() )
344 settings.
remove( QStringLiteral(
"http-header" ) );
353 const QStringList serviceKeys = {QStringLiteral(
"qgis/connections-arcgisfeatureserver" ), QStringLiteral(
"qgis/connections-arcgismapserver" )};
355 for (
const QString &serviceKey : serviceKeys )
358 const QStringList connections = settings.
childGroups();
359 for (
const QString &connection : connections )
370 settings.
remove( QStringLiteral(
"http-header" ) );
374 settings.
remove( serviceKey );
382 const QStringList deviceNames = settings->
value( QStringLiteral(
"/Plugin-GPS/devices/deviceList" ) ).toStringList();
384 for (
const QString &device : deviceNames )
399void QgsSettingsRegistryCore::backwardCompatibility()
422#if defined( HAVE_QTSERIALPORT )
423 QgsGpsDetector::settingsGpsStopBits->copyValueToKeyIfChanged( QStringLiteral(
"core/gps/stop_bits" ) );
424 QgsGpsDetector::settingsGpsFlowControl->copyValueToKeyIfChanged( QStringLiteral(
"core/gps/flow_control" ) );
425 QgsGpsDetector::settingsGpsDataBits->copyValueToKeyIfChanged( QStringLiteral(
"core/gps/data_bits" ) );
426 QgsGpsDetector::settingsGpsParity->copyValueToKeyIfChanged( QStringLiteral(
"core/gps/parity" ) );
439 settingsDigitizingLineColor->
copyValueToKeys( QStringLiteral(
"qgis/digitizing/line_color_red" ), QStringLiteral(
"qgis/digitizing/line_color_green" ), QStringLiteral(
"qgis/digitizing/line_color_blue" ), QStringLiteral(
"qgis/digitizing/line_color_alpha" ) );
441 settingsDigitizingFillColor->
copyValueToKeys( QStringLiteral(
"qgis/digitizing/fill_color_red" ), QStringLiteral(
"qgis/digitizing/fill_color_green" ), QStringLiteral(
"qgis/digitizing/fill_color_blue" ), QStringLiteral(
"qgis/digitizing/fill_color_alpha" ) );
446 QString name = setting->name();
454 name = QStringLiteral(
"reuseLastValues" );
458 name.replace(
'-',
'_' );
460 setting->copyValueToKeyIfChanged( QString(
"qgis/digitizing/%1" ).arg( name ) );
467 for (
const QString &filter : filters )
477 const QStringList services = {QStringLiteral(
"WMS" ), QStringLiteral(
"WFS" ), QStringLiteral(
"WCS" )};
478 for (
const QString &service : services )
481 if ( connections.count() == 0 )
484 for (
const QString &connection : connections )
505 settings->beginGroup( QStringLiteral(
"qgis/connections-%1/%2" ).arg( service.toLower(), connection ) );
506 headers.updateSettings( *settings );
507 settings->endGroup();
520 const QStringList connections = QgsVectorTileProviderConnection::sTreeConnectionVectorTile->items();
522 for (
const QString &connection : connections )
525 QgsVectorTileProviderConnection::settingsUrl->copyValueToKey( QStringLiteral(
"qgis/connections-vector-tile/%1/url" ), {connection} );
526 QgsVectorTileProviderConnection::settingsZmin->copyValueToKey( QStringLiteral(
"qgis/connections-vector-tile/%1/zmin" ), {connection} );
527 QgsVectorTileProviderConnection::settingsZmax->copyValueToKey( QStringLiteral(
"qgis/connections-vector-tile/%1/zmax" ), {connection} );
528 QgsVectorTileProviderConnection::settingsAuthcfg->copyValueToKey( QStringLiteral(
"qgis/connections-vector-tile/%1/authcfg" ), {connection} );
529 QgsVectorTileProviderConnection::settingsUsername->copyValueToKey( QStringLiteral(
"qgis/connections-vector-tile/%1/username" ), {connection} );
530 QgsVectorTileProviderConnection::settingsPassword->copyValueToKey( QStringLiteral(
"qgis/connections-vector-tile/%1/password" ), {connection} );
531 QgsVectorTileProviderConnection::settingsStyleUrl->copyValueToKey( QStringLiteral(
"qgis/connections-vector-tile/%1/styleUrl" ), {connection} );
532 QgsVectorTileProviderConnection::settingsServiceType->copyValueToKey( QStringLiteral(
"qgis/connections-vector-tile/%1/serviceType" ), {connection} );
534 if ( QgsVectorTileProviderConnection::settingsHeaders->exists( connection ) )
537 settings->beginGroup( QStringLiteral(
"qgis/connections-vector-tile/%1" ).arg( connection ) );
538 headers.updateSettings( *settings );
539 settings->endGroup();
548 for (
const QString &connection : connections )
564 settings->beginGroup( QStringLiteral(
"qgis/connections-xyz/%1" ).arg( connection ) );
565 headers.updateSettings( *settings );
566 settings->endGroup();
575 for (
const QString &connection : connections )
590 settings->beginGroup( QStringLiteral(
"qgis/connections-arcgisfeatureserver/%1" ).arg( connection ) );
591 headers.updateSettings( *settings );
592 settings->endGroup();
602 settings->setValue( QStringLiteral(
"/Plugin-GPS/devices/deviceList" ), devices );
603 for (
const QString &device : devices )
SettingsOption
Settings options.
static const Qgis::MapToolUnit DEFAULT_SNAP_UNITS
Default snapping distance units.
@ Pixels
Pixels unit of tolerance.
static const double DEFAULT_Z_COORDINATE
Default Z coordinate value.
static const double DEFAULT_SNAP_TOLERANCE
Default snapping distance tolerance.
static const double DEFAULT_M_COORDINATE
Default M coordinate value.
static QString defaultProjectScales()
A string with default project scales.
@ Round
Use rounded joins.
@ AllLayers
On all vector layers.
static const QgsSettingsEntryString * settingsUsername
static const QgsSettingsEntryString * settingsUrl
static const QgsSettingsEntryString * settingsPassword
static const QgsSettingsEntryVariantMap * settingsHeaders
static const QgsSettingsEntryString * settingsContentEndpoint
static QgsSettingsTreeNamedListNode * sTreeConnectionArcgis
static const QgsSettingsEntryString * settingsAuthcfg
static const QgsSettingsEntryString * settingsCommunityEndpoint
static const QgsSettingsEntryStringList * settingsSearchPathForTemplates
Settings entry search path for templates.
static QgsSettingsTreeNamedListNode * sTreeLocatorFilters
static const QgsSettingsEntryBool * settingsLocatorFilterDefault
Settings entry locator filter default value.
static const QgsSettingsEntryBool * settingsLocatorFilterEnabled
Settings entry locator filter enabled.
static const QgsSettingsEntryString * settingsLocatorFilterPrefix
Settings entry locator filter prefix.
static const QgsSettingsEntryInteger * settingsNetworkTimeout
Settings entry network timeout.
static const QgsSettingsEntryBool * settingsPreferCoordinatesForWfsT11
static const QgsSettingsEntryString * settingsPagingEnabled
static const QgsSettingsEntryString * settingsMaxNumFeatures
static QgsSettingsTreeNamedListNode * sTreeOwsConnections
static const QgsSettingsEntryBool * settingsIgnoreGetFeatureInfoURI
static const QgsSettingsEntryString * settingsPassword
static const QgsSettingsEntryBool * settingsReportedLayerExtents
static const QgsSettingsEntryEnumFlag< Qgis::DpiMode > * settingsDpiMode
static const QgsSettingsEntryBool * settingsIgnoreAxisOrientation
static const QgsSettingsEntryBool * settingsInvertAxisOrientation
static const QgsSettingsEntryString * settingsVersion
static const QgsSettingsEntryString * settingsPagesize
static const QgsSettingsEntryString * settingsAuthCfg
static const QgsSettingsEntryEnumFlag< Qgis::TilePixelRatio > * settingsTilePixelRatio
static const QgsSettingsEntryVariantMap * settingsHeaders
static const QgsSettingsEntryString * settingsUsername
static const QgsSettingsEntryBool * settingsSmoothPixmapTransform
static const QgsSettingsEntryString * settingsUrl
static const QgsSettingsEntryBool * settingsIgnoreGetMapURI
static const QgsSettingsEntryString * settingsTempPath
Settings entry temp path.
static const QgsSettingsEntryBool * settingsPreferFilenameAsLayerName
Settings entry prefer filename as layer name.
static const QgsSettingsEntryBool * settingsRasterDefaultEarlyResampling
static const QgsSettingsEntryDouble * settingsRasterDefaultOversampling
bool setValue(const T &value, const QString &dynamicKeyPart=QString()) const
Set settings value.
Represent settings entry and provides methods for reading and writing settings values.
bool copyValueFromKey(const QString &key, bool removeSettingAtKey=false) const
Copies the value from a given key if it exists.
bool exists(const QString &dynamicKeyPart=QString()) const
Returns true if the settings is contained in the underlying QSettings.
bool hasChanged() const
Returns true if the setting was changed during the current QGIS session.
void copyValueToKeyIfChanged(const QString &key, const QStringList &dynamicKeyPartList=QStringList()) const
Copies the settings to the given key, if it has changed during the current QGIS session (see hasChang...
QString name() const
Returns the name of the settings.
void copyValueToKey(const QString &key, const QStringList &dynamicKeyPartList=QStringList()) const
Copies the settings to the given key.
A boolean settings entry.
bool copyValueFromKeys(const QString &redKey, const QString &greenKey, const QString &blueKey, const QString &alphaKey=QString(), bool removeSettingAtKey=false) const
Copies the value from the given keys if they exist.
void copyValueToKeys(const QString &redKey, const QString &greenKey, const QString &blueKey, const QString &alphaKey=QString()) const
Copies the settings to the given keys.
A template class for enum and flag settings entry.
A 64 bits integer (long long) settings entry.
An integer settings entry.
A string list settings entry.
static const QgsSettingsEntryDouble * settingsDigitizingSearchRadiusVertexEdit
Settings entry digitizing search radius vertex edit.
static const QgsSettingsEntryBool * settingsDigitizingDefaultSnapEnabled
Settings entry digitizing default snap enabled.
static const QgsSettingsEntryEnumFlag< Qgis::MapToolUnit > * settingsDigitizingDefaultSnappingToleranceUnit
Settings entry digitizing default snapping tolerance unit.
static const QgsSettingsEntryDouble * settingsDigitizingOffsetMiterLimit
Settings entry digitizing offset miter limit.
static const QgsSettingsEntryEnumFlag< Qgis::JoinStyle > * settingsDigitizingOffsetJoinStyle
Settings entry digitizing offset join style.
static const QgsSettingsEntryDouble * settingsDigitizingMarkerSizeMm
Settings entry digitizing marker size mm.
static const QgsSettingsEntryEnumFlag< Qgis::MapToolUnit > * settingsDigitizingSearchRadiusVertexEditUnit
Settings entry digitizing search radius vertex edit unit.
static const QgsSettingsEntryBool * settingsLayerTreeShowFeatureCountForNewLayers
Settings entry show feature counts for newly added layers by default.
static const QgsSettingsEntryInteger * settingsDigitizingTracingMaxFeatureCount
Settings entry digitizing tracing max feature count.
static const QgsSettingsEntryColor * settingsDigitizingFillColor
Settings entry digitizing fill color.
static const QgsSettingsEntryBool * settingsAutosizeAttributeTable
Settings entry autosize columns by default when opening attribute table.
static const QgsSettingsEntryBool * settingsDigitizingDisableEnterAttributeValuesDialog
Settings entry digitizing disable enter attribute values dialog.
static const QgsSettingsEntryDouble * settingsDigitizingDefaultSnappingTolerance
Settings entry digitizing default snapping tolerance.
static const QgsSettingsEntryInteger * settingsDigitizingLineWidth
Settings entry digitizing line width.
static const QgsSettingsEntryInteger * settingsDigitizingStreamTolerance
Settings entry digitizing stream tolerance.
static const QgsSettingsEntryBool * settingsDigitizingSnapTooltip
Settings entry digitizing snap tooltip.
static const QgsSettingsEntryEnumFlag< Qgis::SnappingMode > * settingsDigitizingDefaultSnapMode
Settings entry digitizing default snap type.
static const QgsSettingsEntryInteger64 * settingsNetworkCacheSize
Settings entry network cache directory.
static const QgsSettingsEntryBool * settingsDigitizingSnapInvisibleFeature
Settings entry digitizing snap invisible feature.
static const QgsSettingsEntryDouble * settingsDigitizingLineColorAlphaScale
Settings entry digitizing line color alpha scale.
static const QgsSettingsEntryDouble * settingsDigitizingDefaultMValue
Settings entry digitizing default m value.
static const QgsSettingsEntryBool * settingsDigitizingLineGhost
Settings entry digitizing line ghost.
static const QgsSettingsEntryBool * settingsDigitizingMarkerOnlyForSelected
Settings entry digitizing marker only for selected.
static const QgsSettingsEntryColor * settingsDigitizingSnapColor
Settings entry digitizing snap color.
static const QgsSettingsEntryDouble * settingsDigitizingConvertToCurveAngleTolerance
Settings entry digitizing convert to curve angle tolerance.
static const QgsSettingsEntryString * settingsGpsBabelPath
Settings entry path to GPSBabel executable.
virtual ~QgsSettingsRegistryCore()
static const QgsSettingsEntryDouble * settingsDigitizingConvertToCurveDistanceTolerance
Settings entry digitizing convert to curve distance tolerance.
static const QgsSettingsEntryInteger * settingsDigitizingValidateGeometries
Settings entry digitizing validate geometries.
static const QgsSettingsEntryColor * settingsDigitizingLineColor
Settings entry digitizing line color.
static const QgsSettingsEntryInteger * settingsLayerParallelLoadingMaxCount
Settings entry maximum thread count used to load layer in parallel.
QgsSettingsRegistryCore()
static const QgsSettingsEntryBool * settingsDigitizingReuseLastValues
Settings entry digitizing reuseLastValues.
static const QgsSettingsEntryStringList * settingsMapScales
static const QgsSettingsEntryBool * settingsLayerParallelLoading
Settings entry whether layer are loading in parallel.
static const QgsSettingsEntryBool * settingsEnableWMSTilePrefetching
Settings entry enable WMS tile prefetching.
static const QgsSettingsEntryEnumFlag< Qgis::EndCapStyle > * settingsDigitizingOffsetCapStyle
Settings entry digitizing offset cap style.
static const QgsSettingsEntryEnumFlag< Qgis::SnappingType > * settingsDigitizingDefaultSnapType
Settings entry digitizing default snap type.
static const QgsSettingsEntryBool * settingsDigitizingConvertToCurve
Settings entry digitizing convert to curve.
static const QgsSettingsEntryDouble * settingsDigitizingDefaultZValue
Settings entry digitizing default z value.
static const QgsSettingsEntryString * settingsDigitizingMarkerStyle
Settings entry digitizing marker style.
static const QgsSettingsEntryBool * settingsDigitizingOffsetShowAdvanced
Settings entry digitizing offset show advanced.
static const QgsSettingsEntryInteger * settingsDigitizingOffsetQuadSeg
Settings entry digitizing offset quad seg.
static const QgsSettingsEntryString * settingsNetworkCacheDirectory
Settings entry network cache directory.
QgsSettingsRegistry is used for settings introspection and collects a list of child QgsSettingsRegist...
void setSelectedItem(const QString &item, const QStringList &parentsNamedItems=QStringList())
Sets the selected named item from the named list node.
QStringList items(const QStringList &parentsNamedItems=QStringList()) const
Returns the list of items.
QList< const QgsSettingsEntryBase * > childrenSettings() const
Returns the children settings.
static QgsSettingsTreeNode * sTreeDigitizing
static QgsSettingsTreeNode * sTreeWms
static QgsSettingsTreeNode * sTreeLayerTree
static QgsSettingsTreeNode * sTreeNetworkCache
static QgsSettingsTreeNode * sTreeGps
static QgsSettingsTreeNode * sTreeAttributeTable
static QgsSettingsTreeNode * sTreeMap
static QgsSettingsTreeNode * sTreeCore
This class is a composition of two QSettings instances:
QStringList childGroups(Qgis::SettingsOrigin origin=Qgis::SettingsOrigin::Any) const
Returns a list of all key top-level groups that contain keys that can be read using the QSettings obj...
void endGroup()
Resets the group to what it was before the corresponding beginGroup() call.
QVariant value(const QString &key, const QVariant &defaultValue=QVariant(), Section section=NoSection) const
Returns the value for setting key.
bool contains(const QString &key, QgsSettings::Section section=QgsSettings::NoSection) const
Returns true if there exists a setting called key; returns false otherwise.
void beginGroup(const QString &prefix, QgsSettings::Section section=QgsSettings::NoSection)
Appends prefix to the current group.
static void releaseFlush()
Releases a previously made hold on flushing QgsSettings objects and writing new values to the underly...
static void holdFlush()
Temporarily places a hold on flushing QgsSettings objects and writing new values to the underlying in...
void remove(const QString &key, QgsSettings::Section section=QgsSettings::NoSection)
Removes the setting key and any sub-settings of key in a section.
static QgsSettingsProxy get()
Returns a proxy for a QgsSettings object.
static QgsSettingsTreeNamedListNode * sTreeXyzConnections
static const QgsSettingsEntryString * settingsPassword
static const QgsSettingsEntryDouble * settingsTilePixelRatio
static const QgsSettingsEntryString * settingsInterpretation
static const QgsSettingsEntryString * settingsUsername
static const QgsSettingsEntryString * settingsAuthcfg
static const QgsSettingsEntryInteger * settingsZmin
static const QgsSettingsEntryBool * settingsHidden
static const QgsSettingsEntryInteger * settingsZmax
static const QgsSettingsEntryString * settingsUrl
static const QgsSettingsEntryVariantMap * settingsHeaders
static const QgsSettingsEntryInteger * settingsRenderingLabelCandidatesLimitLines
static const QgsSettingsEntryInteger * settingsRenderingLabelCandidatesLimitPoints
static const QgsSettingsEntryInteger * settingsRenderingLabelCandidatesLimitPolygons
#define Q_NOWARN_DEPRECATED_POP
#define Q_NOWARN_DEPRECATED_PUSH