89 const QString &application = QString(), QObject *parent =
nullptr );
105 QgsSettings( QSettings::Scope scope,
const QString &organization,
106 const QString &application = QString(), QObject *parent =
nullptr );
122 QgsSettings( QSettings::Format format, QSettings::Scope scope,
const QString &organization,
123 const QString &application = QString(), QObject *parent =
nullptr );
145 QgsSettings(
const QString &fileName, QSettings::Format format, QObject *parent =
nullptr );
175 QString group()
const;
178 QStringList allKeys()
const;
180 QStringList childKeys()
const;
184 QStringList globalChildGroups()
const;
186 static QString globalSettingsPath();
188 static bool setGlobalSettingsPath(
const QString &path );
190 int beginReadArray(
const QString &prefix );
197 void beginWriteArray(
const QString &prefix,
int size = -1 );
205 void setArrayIndex(
int i );
227 QVariant value(
const QString &key,
const QVariant &defaultValue = QVariant(),
228 Section section = NoSection )
const;
230 SIP_PYOBJECT value(
const QString &key,
const QVariant &defaultValue = QVariant(),
231 SIP_PYOBJECT type = 0,
234 typedef PyObject *( *pyqt_from_qvariant_by_type )( QVariant &value, PyObject *type );
238 Py_BEGIN_ALLOW_THREADS
239 value = sipCpp->value( *a0, *a1, a3 );
242 pyqt_from_qvariant_by_type f = ( pyqt_from_qvariant_by_type ) sipImportSymbol( SIP_PYQT_FROM_QVARIANT_BY_TYPE );
243 sipRes = f( value, a2 );
264 const Section section = NoSection )
266 const QMetaEnum metaEnum = QMetaEnum::fromType<T>();
267 Q_ASSERT( metaEnum.isValid() );
268 if ( !metaEnum.isValid() )
270 QgsDebugError( QStringLiteral(
"Invalid metaenum. Enum probably misses Q_ENUM or Q_FLAG declaration." ) );
276 if ( metaEnum.isValid() )
279 QByteArray ba = value( key, metaEnum.valueToKey(
static_cast<const int>( defaultValue ) ), section ).toString().toUtf8();
280 const char *vs = ba.data();
281 v =
static_cast<T
>( metaEnum.keyToValue( vs, &ok ) );
289 v =
static_cast<T
>( value( key,
static_cast<const int>( defaultValue ), section ).toInt( &ok ) );
290 if ( metaEnum.isValid() )
292 if ( !ok || !metaEnum.valueToKey(
static_cast<int>( v ) ) )
300 setEnumValue( key, v, section );
316 const Section section = NoSection )
318 const QMetaEnum metaEnum = QMetaEnum::fromType<T>();
319 Q_ASSERT( metaEnum.isValid() );
320 if ( metaEnum.isValid() )
322 setValue( key, metaEnum.valueToKey(
static_cast<const int>( value ) ), section );
326 QgsDebugError( QStringLiteral(
"Invalid metaenum. Enum probably misses Q_ENUM or Q_FLAG declaration." ) );
342 const Section section = NoSection )
344 const QMetaEnum metaEnum = QMetaEnum::fromType<T>();
345 Q_ASSERT( metaEnum.isValid() );
346 if ( !metaEnum.isValid() )
348 QgsDebugError( QStringLiteral(
"Invalid metaenum. Enum probably misses Q_ENUM or Q_FLAG declaration." ) );
354 if ( metaEnum.isValid() )
357 QByteArray ba = value( key, metaEnum.valueToKeys(
static_cast< const int >( defaultValue ) ) ).toString().toUtf8();
358 const char *vs = ba.data();
359 v =
static_cast<T
>( metaEnum.keysToValue( vs, &ok ) );
364 const int intValue = value( key,
static_cast<const int>( defaultValue ), section ).toInt( &ok );
365 if ( metaEnum.isValid() )
371 const QByteArray keys = metaEnum.valueToKeys( intValue );
372 const int intValueCheck = metaEnum.keysToValue( keys );
373 if ( intValue != intValueCheck )
384 setFlagValue( key, v );
406 const Section section = NoSection )
408 const QMetaEnum metaEnum = QMetaEnum::fromType<T>();
409 Q_ASSERT( metaEnum.isValid() );
410 if ( metaEnum.isValid() )
412 setValue( key, metaEnum.valueToKeys(
static_cast< const int >( value ) ), section );
416 QgsDebugError( QStringLiteral(
"Invalid metaenum. Enum probably misses Q_ENUM or Q_FLAG declaration." ) );
427 QString fileName()
const;
477 static
void releaseFlush()
SIP_SKIP;
496 QString sanitizeKey( const QString &key ) const;
497 QSettings *mUserSettings =
nullptr;
498 QSettings *mGlobalSettings =
nullptr;
499 bool mUsingGlobalArray = false;