36 for (
const auto *setting : std::as_const( mSettings ) )
38 QString otherBaseKey = setting->definitionKey();
39 otherBaseKey = otherBaseKey.left( otherBaseKey.lastIndexOf(
'/'_L1 ) );
40 if ( mDefinitionBaseKey.isEmpty() )
42 mDefinitionBaseKey = otherBaseKey;
46 if ( mDefinitionBaseKey != otherBaseKey )
48 QgsDebugError(
"Settings do not share the same base definition key for this group. This will lead to unpredictable results." );
49 if ( fatalErrorIfInvalid )
59 QString key = mDefinitionBaseKey;
61 if ( dynamicKeyPartList.isEmpty() )
63 if ( hasDynamicKey() )
64 QgsDebugError( u
"Settings group '%1' have a dynamic key but the dynamic key part was not provided"_s.arg( key ) );
70 if ( !hasDynamicKey() )
72 QgsDebugError( u
"Settings group '%1' don't have a dynamic key, the provided dynamic key part will be ignored"_s.arg( key ) );
76 for (
int i = 0; i < dynamicKeyPartList.size(); i++ )
78 key.replace( u
"%"_s.append( QString::number( i + 1 ) ), dynamicKeyPartList.at( i ) );
static QStringList dynamicKeyPartToList(const QString &dynamicKeyPart)
Transforms a dynamic key part string to list.
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.