32 : mSettings( settings )
34 for (
const auto *setting : std::as_const( mSettings ) )
36 QString otherBaseKey = setting->definitionKey();
37 otherBaseKey = otherBaseKey.left( otherBaseKey.lastIndexOf( QLatin1Char(
'/' ) ) );
38 if ( mDefinitionBaseKey.isEmpty() )
40 mDefinitionBaseKey = otherBaseKey;
44 if ( mDefinitionBaseKey != otherBaseKey )
46 QgsDebugError(
"Settings do not share the same base definition key for this group. This will lead to unpredictable results." );
47 if ( fatalErrorIfInvalid )
57 QString key = mDefinitionBaseKey;
59 if ( dynamicKeyPartList.isEmpty() )
61 if ( hasDynamicKey() )
62 QgsDebugError( QStringLiteral(
"Settings group '%1' have a dynamic key but the dynamic key part was not provided" ).arg( key ) );
68 if ( !hasDynamicKey() )
70 QgsDebugError( QStringLiteral(
"Settings group '%1' don't have a dynamic key, the provided dynamic key part will be ignored" ).arg( key ) );
74 for (
int i = 0; i < dynamicKeyPartList.size(); i++ )
76 key.replace( QStringLiteral(
"%" ).append( QString::number( i + 1 ) ), dynamicKeyPartList.at( i ) );
static QStringList dynamicKeyPartToList(const QString &dynamicKeyPart)
Transforms a dynamic key part string to list.
Creates a group of setting which have a common definition of base key.
void removeAllChildrenSettings(const QString &dynamicKeyPart=QString()) const
Removes all the settings from this group The dynamicKeyPart argument specifies the dynamic part of th...
const QList< const QgsSettingsEntryBase * > settings() const
Returns all the settings.
void removeAllSettingsAtBaseKey(const QStringList &dynamicKeyPartList=QStringList()) const
Removes all the settings at the base key for the given dynamicKeyPartList This means it might remove ...
QgsSettingsEntryGroup(QList< const QgsSettingsEntryBase * > settings)
Constructor.
QString baseKey(const QStringList &dynamicKeyPartList=QStringList()) const
Returns the base key for the given dynamicKeyPartList.