Skip to content

PythonQt.QtCore.QSettings · declarations 002

Back to PythonQt.QtCore.QSettings

fileName

fileName() -> str

X.fileName() -> str

Supplemental documentation: Qt 5 reference:

QString QSettings::fileName() const

Returns the path where settings written using this QSettings object are stored.

On Windows, if the format is QSettings::NativeFormat, the return value is a system registry path, not a file path.

See also isWritable() and format().

Upstream PySide2 reference signatures (binding differences may apply):

fileName(self) -> str

Source: https://doc.qt.io/archives/qt-5.15/qsettings.html#fileName

format

format() -> Any

X.format()

Supplemental documentation: Qt 5 reference:

QSettings::Format QSettings::format() const

Returns the format used for storing the settings.

This function was introduced in Qt 4.4.

See also defaultFormat(), fileName(), scope(), organizationName(), and applicationName().

Upstream PySide2 reference signatures (binding differences may apply):

format(self) -> PySide2.QtCore.QSettings.Format

Source: https://doc.qt.io/archives/qt-5.15/qsettings.html#format

group

group() -> str

X.group() -> str

Supplemental documentation: Qt 5 reference:

QString QSettings::group() const

Returns the current group.

See also beginGroup() and endGroup().

Upstream PySide2 reference signatures (binding differences may apply):

group(self) -> str

Source: https://doc.qt.io/archives/qt-5.15/qsettings.html#group

iniCodec

iniCodec() -> Any

X.iniCodec() -> PythonQt.QtCore.QTextCodec

Supplemental documentation: Qt 5 reference:

QTextCodec *QSettings::iniCodec() const

Returns the codec that is used for accessing INI files. By default, no codec is used, so nullptr is returned.

This function was introduced in Qt 4.5.

See also setIniCodec().

Upstream PySide2 reference signatures (binding differences may apply):

iniCodec(self) -> PySide2.QtCore.QTextCodec

Source: https://doc.qt.io/archives/qt-5.15/qsettings.html#iniCodec

isWritable

isWritable() -> bool

X.isWritable() -> bool

Supplemental documentation: Qt 5 reference:

bool QSettings::isWritable() const

Returns true if settings can be written using this QSettings object; returns false otherwise.

One reason why isWritable() might return false is if QSettings operates on a read-only file.

Warning: This function is not perfectly reliable, because the file permissions can change at any time.

See also fileName(), status(), and sync().

Upstream PySide2 reference signatures (binding differences may apply):

isWritable(self) -> bool

Source: https://doc.qt.io/archives/qt-5.15/qsettings.html#isWritable

objectNameChanged

objectNameChanged(*args: Any, **kwargs: Any) -> Any

Native PythonQt.QtCore.QSettings.objectNameChanged; argument details are not documented.

organizationName

organizationName() -> str

X.organizationName() -> str

Supplemental documentation: Qt 5 reference:

QString QSettings::organizationName() const

Returns the organization name used for storing the settings.

This function was introduced in Qt 4.4.

See also QCoreApplication::organizationName(), format(), scope(), and applicationName().

Upstream PySide2 reference signatures (binding differences may apply):

organizationName(self) -> str

Source: https://doc.qt.io/archives/qt-5.15/qsettings.html#organizationName

remove

remove(key: str) -> None

X.remove(key)

Supplemental documentation: Qt 5 reference:

void QSettings::remove(const QString \&key)

Removes the setting key and any sub-settings of key.

Example:

QSettings settings;
settings.setValue("ape");
settings.setValue("monkey", 1);
settings.setValue("monkey/sea", 2);
settings.setValue("monkey/doe", 4);

settings.remove("monkey");
QStringList keys = settings.allKeys();
// keys: ["ape"]

Be aware that if one of the fallback locations contains a setting with the same key, that setting will be visible after calling remove().

If key is an empty string, all keys in the current group() are removed. For example:

QSettings settings;
settings.setValue("ape");
settings.setValue("monkey", 1);
settings.setValue("monkey/sea", 2);
settings.setValue("monkey/doe", 4);

settings.beginGroup("monkey");
settings.remove("");
settings.endGroup();

QStringList keys = settings.allKeys();
// keys: ["ape"]

Note that the Windows registry and INI files use case-insensitive keys, whereas the CFPreferences API on macOS and iOS uses case-sensitive keys. To avoid portability problems, see the Section and Key Syntax rules.

See also setValue(), value(), and contains().

Upstream PySide2 reference signatures (binding differences may apply):

remove(self, key: str) -> None

Source: https://doc.qt.io/archives/qt-5.15/qsettings.html#remove

scope

scope() -> Any

X.scope()

Supplemental documentation: Qt 5 reference:

QSettings::Scope QSettings::scope() const

Returns the scope used for storing the settings.

This function was introduced in Qt 4.4.

See also format(), organizationName(), and applicationName().

Upstream PySide2 reference signatures (binding differences may apply):

scope(self) -> PySide2.QtCore.QSettings.Scope

Source: https://doc.qt.io/archives/qt-5.15/qsettings.html#scope

setArrayIndex

setArrayIndex(i: int) -> None

X.setArrayIndex(i)

Supplemental documentation: Qt 5 reference:

void QSettings::setArrayIndex(int i)

Sets the current array index to i. Calls to functions such as setValue(), value(), remove(), and contains() will operate on the array entry at that index.

You must call beginReadArray() or beginWriteArray() before you can call this function.

Upstream PySide2 reference signatures (binding differences may apply):

setArrayIndex(self, i: int) -> None

Source: https://doc.qt.io/archives/qt-5.15/qsettings.html#setArrayIndex

setDefaultFormat

setDefaultFormat(format: Any) -> None

X.setDefaultFormat(format)

Supplemental documentation: Qt 5 reference:

[static] void QSettings::setDefaultFormat(QSettings::Format format)

Sets the default file format to the given format, which is used for storing settings for the QSettings(QObject *) constructor.

If no default format is set, QSettings::NativeFormat is used. See the documentation for the QSettings constructor you are using to see if that constructor will ignore this function.

This function was introduced in Qt 4.4.

See also defaultFormat() and format().

Upstream PySide2 reference signatures (binding differences may apply):

setDefaultFormat(format: PySide2.QtCore.QSettings.Format) -> None

Source: https://doc.qt.io/archives/qt-5.15/qsettings.html#setDefaultFormat

setFallbacksEnabled

setFallbacksEnabled(b: bool) -> None

X.setFallbacksEnabled(b)

Supplemental documentation: Qt 5 reference:

void QSettings::setFallbacksEnabled(bool b)

Sets whether fallbacks are enabled to b.

By default, fallbacks are enabled.

See also fallbacksEnabled().

Upstream PySide2 reference signatures (binding differences may apply):

setFallbacksEnabled(self, b: bool) -> None

Source: https://doc.qt.io/archives/qt-5.15/qsettings.html#setFallbacksEnabled

setIniCodec

setIniCodec(codec: Any) -> None

X.setIniCodec(codec)

Supplemental documentation: Qt 5 reference:

void QSettings::setIniCodec(QTextCodec *codec)

Sets the codec for accessing INI files (including .conf files on Unix) to codec. The codec is used for decoding any data that is read from the INI file, and for encoding any data that is written to the file. By default, no codec is used, and non-ASCII characters are encoded using standard INI escape sequences.

Warning: The codec must be set immediately after creating the QSettings object, before accessing any data.

This function was introduced in Qt 4.5.

See also iniCodec().

void QSettings::setIniCodec(const char *codecName)

This is an overloaded function.

Sets the codec for accessing INI files (including .conf files on Unix) to the QTextCodec for the encoding specified by codecName. Common values for codecName include "ISO 8859-1", "UTF-8", and "UTF-16". If the encoding isn't recognized, nothing happens.

This function was introduced in Qt 4.5.

See also QTextCodec::codecForName().

Upstream PySide2 reference signatures (binding differences may apply):

setIniCodec(self, codec: PySide2.QtCore.QTextCodec) -> None
setIniCodec(self, codecName: str) -> None

Source: https://doc.qt.io/archives/qt-5.15/qsettings.html#setIniCodec

setPath

setPath(format: Any, scope: Any, path: str) -> None

X.setPath(format, scope, path)

Supplemental documentation: Qt 5 reference:

[static] void QSettings::setPath(QSettings::Format format, QSettings::Scope scope, const QString \&path)

Sets the path used for storing settings for the given format and scope, to path. The format can be a custom format.

The table below summarizes the default values:

Platform Format Scope Path
Windows IniFormat UserScope FOLDERID_RoamingAppData
SystemScope FOLDERID_ProgramData
Unix NativeFormat, IniFormat UserScope $HOME/.config
SystemScope /etc/xdg
macOS and iOS IniFormat UserScope $HOME/.config
SystemScope /etc/xdg

The default UserScope paths on Unix, macOS, and iOS ($HOME/.config or $HOME/Settings) can be overridden by the user by setting the XDG_CONFIG_HOME environment variable. The default SystemScope paths on Unix, macOS, and iOS (/etc/xdg) can be overridden when building the Qt library using the configure script's -sysconfdir flag (see QLibraryInfo for details).

Setting the NativeFormat paths on Windows, macOS, and iOS has no effect.

Warning: This function doesn't affect existing QSettings objects.

This function was introduced in Qt 4.1.

See also registerFormat().

Upstream PySide2 reference signatures (binding differences may apply):

setPath(format: PySide2.QtCore.QSettings.Format, scope: PySide2.QtCore.QSettings.Scope, path: str) -> None

Source: https://doc.qt.io/archives/qt-5.15/qsettings.html#setPath

setValue

setValue(key: str, value: Any) -> None

X.setValue(key, value)

Supplemental documentation: Qt 5 reference:

void QSettings::setValue(const QString \&key, const QVariant \&value)

Sets the value of setting key to value. If the key already exists, the previous value is overwritten.

Note that the Windows registry and INI files use case-insensitive keys, whereas the CFPreferences API on macOS and iOS uses case-sensitive keys. To avoid portability problems, see the Section and Key Syntax rules.

Example:

QSettings settings;
settings.setValue("interval", 30);
settings.value("interval").toInt();     // returns 30

settings.setValue("interval", 6.55);
settings.value("interval").toDouble();  // returns 6.55

See also value(), remove(), and contains().

Upstream PySide2 reference signatures (binding differences may apply):

setValue(self, key: str, value: typing.Any) -> None

Source: https://doc.qt.io/archives/qt-5.15/qsettings.html#setValue

status

status() -> Any

X.status()

Supplemental documentation: Qt 5 reference:

QSettings::Status QSettings::status() const

Returns a status code indicating the first error that was met by QSettings, or QSettings::NoError if no error occurred.

Be aware that QSettings delays performing some operations. For this reason, you might want to call sync() to ensure that the data stored in QSettings is written to disk before calling status().

See also sync().

Upstream PySide2 reference signatures (binding differences may apply):

status(self) -> PySide2.QtCore.QSettings.Status

Source: https://doc.qt.io/archives/qt-5.15/qsettings.html#status

sync

sync() -> None

X.sync()

Supplemental documentation: Qt 5 reference:

void QSettings::sync()

Writes any unsaved changes to permanent storage, and reloads any settings that have been changed in the meantime by another application.

This function is called automatically from QSettings's destructor and by the event loop at regular intervals, so you normally don't need to call it yourself.

See also status().

Upstream PySide2 reference signatures (binding differences may apply):

sync(self) -> None

Source: https://doc.qt.io/archives/qt-5.15/qsettings.html#sync

value

value(key: Any, defaultValue: Any) -> Any

X.value(key, defaultValue) -> object

Supplemental documentation: Qt 5 reference:

QVariant QSettings::value(const QString \&key, const QVariant \&defaultValue \= QVariant()) const

Returns the value for setting key. If the setting doesn't exist, returns defaultValue.

If no default value is specified, a default QVariant is returned.

Note that the Windows registry and INI files use case-insensitive keys, whereas the CFPreferences API on macOS and iOS uses case-sensitive keys. To avoid portability problems, see the Section and Key Syntax rules.

Example:

QSettings settings;
settings.setValue("animal/snake", 58);
settings.value("animal/snake", 1024).toInt();   // returns 58
settings.value("animal/zebra", 1024).toInt();   // returns 1024
settings.value("animal/zebra").toInt();         // returns 0

See also setValue(), contains(), and remove().

Upstream PySide2 reference signatures (binding differences may apply):

value(self, arg__1: str, defaultValue: typing.Optional[typing.Any]=..., type: object=...) -> object

Source: https://doc.qt.io/archives/qt-5.15/qsettings.html#value