38 for (
const auto *setting : std::as_const( mSettings ) )
40 QString otherBaseKey = setting->definitionKey();
41 otherBaseKey = otherBaseKey.left( otherBaseKey.lastIndexOf(
'/'_L1 ) );
42 if ( mDefinitionBaseKey.isEmpty() )
44 mDefinitionBaseKey = otherBaseKey;
48 if ( mDefinitionBaseKey != otherBaseKey )
50 QgsDebugError(
"Settings do not share the same base definition key for this group. This will lead to unpredictable results." );
51 if ( fatalErrorIfInvalid )
61 QString key = mDefinitionBaseKey;
63 if ( dynamicKeyPartList.isEmpty() )
65 if ( hasDynamicKey() )
66 QgsDebugError( u
"Settings group '%1' have a dynamic key but the dynamic key part was not provided"_s.arg( key ) );
72 if ( !hasDynamicKey() )
74 QgsDebugError( u
"Settings group '%1' don't have a dynamic key, the provided dynamic key part will be ignored"_s.arg( key ) );
78 for (
int i = 0; i < dynamicKeyPartList.size(); i++ )
80 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.