23 #include "qgis_core.h" 81 const QString &application = QString(), QObject *parent =
nullptr );
96 QgsSettings( QSettings::Scope scope,
const QString &organization,
97 const QString &application = QString(), QObject *parent =
nullptr );
111 QgsSettings( QSettings::Format format, QSettings::Scope scope,
const QString &organization,
112 const QString &application = QString(), QObject *parent =
nullptr );
133 QgsSettings(
const QString &fileName, QSettings::Format format, QObject *parent =
nullptr );
157 QStringList allKeys()
const;
159 QStringList childKeys()
const;
161 QStringList childGroups()
const;
163 QStringList globalChildGroups()
const;
167 static bool setGlobalSettingsPath(
const QString &path );
169 int beginReadArray(
const QString &prefix );
176 void beginWriteArray(
const QString &prefix,
int size = -1 );
184 void setArrayIndex(
int i );
199 QVariant value(
const QString &key,
const QVariant &defaultValue = QVariant(),
200 const Section section = NoSection )
const;
202 SIP_PYOBJECT value(
const QString &key,
const QVariant &defaultValue = QVariant(),
203 SIP_PYOBJECT type = 0,
206 typedef PyObject *( *pyqt5_from_qvariant_by_type )( QVariant &value, PyObject *type );
210 Py_BEGIN_ALLOW_THREADS
211 value = sipCpp->value( *a0, *a1, a3 );
214 pyqt5_from_qvariant_by_type
f = ( pyqt5_from_qvariant_by_type ) sipImportSymbol(
"pyqt5_from_qvariant_by_type" );
215 sipRes =
f( value, a2 );
232 const Section section = NoSection,
bool flag =
false )
const 236 v =
static_cast<T
>( value( key, static_cast<int>( defaultValue ), section ).toInt() );
238 v = T( value( key, static_cast<int>( defaultValue ), section ).toInt() );
240 QMetaEnum metaEnum = QMetaEnum::fromType<T>();
241 if ( metaEnum.isValid() )
243 if ( !flag && !metaEnum.valueToKey( static_cast<int>( v ) ) )
247 else if ( flag && !metaEnum.valueToKeys( static_cast<int>( v ) ).size() )
262 QString fileName()
const;
280 static QString sGlobalSettingsPath;
282 QString sanitizeKey(
const QString &key )
const;
283 QSettings *mUserSettings =
nullptr;
284 QSettings *mGlobalSettings =
nullptr;
285 bool mUsingGlobalArray =
false;
290 #endif // QGSSETTINGS_H T enumValue(const QString &key, const T &defaultValue, const Section section=NoSection, bool flag=false) const
Return the setting value for a setting based on an enum.
This class is a composition of two QSettings instances:
static QString globalSettingsPath()
Return the path to the Global Settings QSettings storage file.
Section
Sections for namespaced settings.