Skip to content

PythonQt.QtCore.QSettings · declarations 001

Back to PythonQt.QtCore.QSettings

AccessError instance-attribute

AccessError: Any

CustomFormat1 instance-attribute

CustomFormat1: Any

CustomFormat10 instance-attribute

CustomFormat10: Any

CustomFormat11 instance-attribute

CustomFormat11: Any

CustomFormat12 instance-attribute

CustomFormat12: Any

CustomFormat13 instance-attribute

CustomFormat13: Any

CustomFormat14 instance-attribute

CustomFormat14: Any

CustomFormat15 instance-attribute

CustomFormat15: Any

CustomFormat16 instance-attribute

CustomFormat16: Any

CustomFormat2 instance-attribute

CustomFormat2: Any

CustomFormat3 instance-attribute

CustomFormat3: Any

CustomFormat4 instance-attribute

CustomFormat4: Any

CustomFormat5 instance-attribute

CustomFormat5: Any

CustomFormat6 instance-attribute

CustomFormat6: Any

CustomFormat7 instance-attribute

CustomFormat7: Any

CustomFormat8 instance-attribute

CustomFormat8: Any

CustomFormat9 instance-attribute

CustomFormat9: Any

Format instance-attribute

Format: type

int([x]) -> integer int(x, base=10) -> integer

Convert a number or string to an integer, or return 0 if no arguments are given. If x is a number, return x.int(). For floating point numbers, this truncates towards zero.

If x is not a number or if base is given, then x must be a string, bytes, or bytearray instance representing an integer literal in the given base. The literal can be preceded by '+' or '-' and be surrounded by whitespace. The base defaults to 10. Valid bases are 0 and 2-36. Base 0 means to interpret the base from the string as an integer literal.

int('0b100', base=0) 4

FormatError instance-attribute

FormatError: Any

IniFormat instance-attribute

IniFormat: Any

InvalidFormat instance-attribute

InvalidFormat: Any

NativeFormat instance-attribute

NativeFormat: Any

Scope instance-attribute

Scope: type

int([x]) -> integer int(x, base=10) -> integer

Convert a number or string to an integer, or return 0 if no arguments are given. If x is a number, return x.int(). For floating point numbers, this truncates towards zero.

If x is not a number or if base is given, then x must be a string, bytes, or bytearray instance representing an integer literal in the given base. The literal can be preceded by '+' or '-' and be surrounded by whitespace. The base defaults to 10. Valid bases are 0 and 2-36. Base 0 means to interpret the base from the string as an integer literal.

int('0b100', base=0) 4

SystemScope instance-attribute

SystemScope: Any

UserScope instance-attribute

UserScope: Any

allKeys

allKeys() -> tuple

X.allKeys() -> tuple

Supplemental documentation: Qt 5 reference:

QStringList QSettings::allKeys() const

Returns a list of all keys, including subkeys, that can be read using the QSettings object.

Example:

QSettings settings;
settings.setValue("fridge/color", QColor(Qt::white));
settings.setValue("fridge/size", QSize(32, 96));
settings.setValue("sofa", true);
settings.setValue("tv", false);

QStringList keys = settings.allKeys();
// keys: ["fridge/color", "fridge/size", "sofa", "tv"]

If a group is set using beginGroup(), only the keys in the group are returned, without the group prefix:

settings.beginGroup("fridge");
keys = settings.allKeys();
// keys: ["color", "size"]

See also childGroups() and childKeys().

Upstream PySide2 reference signatures (binding differences may apply):

allKeys(self) -> typing.List[str]

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

applicationName

applicationName() -> str

X.applicationName() -> str

Supplemental documentation: Qt 5 reference:

QString QSettings::applicationName() const

Returns the application name used for storing the settings.

This function was introduced in Qt 4.4.

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

Upstream PySide2 reference signatures (binding differences may apply):

applicationName(self) -> str

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

beginGroup

beginGroup(prefix: str) -> None

X.beginGroup(prefix)

Supplemental documentation: Qt 5 reference:

void QSettings::beginGroup(const QString \&prefix)

Appends prefix to the current group.

The current group is automatically prepended to all keys specified to QSettings. In addition, query functions such as childGroups(), childKeys(), and allKeys() are based on the group. By default, no group is set.

Groups are useful to avoid typing in the same setting paths over and over. For example:

settings.beginGroup("mainwindow");
settings.setValue("size", win->size());
settings.setValue("fullScreen", win->isFullScreen());
settings.endGroup();

settings.beginGroup("outputpanel");
settings.setValue("visible", panel->isVisible());
settings.endGroup();

This will set the value of three settings:

  • mainwindow/size
  • mainwindow/fullScreen
  • outputpanel/visible

Call endGroup() to reset the current group to what it was before the corresponding beginGroup() call. Groups can be nested.

See also endGroup() and group().

Upstream PySide2 reference signatures (binding differences may apply):

beginGroup(self, prefix: str) -> None

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

beginReadArray

beginReadArray(prefix: str) -> int

X.beginReadArray(prefix) -> int

Supplemental documentation: Qt 5 reference:

int QSettings::beginReadArray(const QString \&prefix)

Adds prefix to the current group and starts reading from an array. Returns the size of the array.

Example:

struct Login {
    QString userName;
    QString password;
};
QList<Login> logins;
...

QSettings settings;
int size = settings.beginReadArray("logins");
for (int i = 0; i < size; ++i) {
    settings.setArrayIndex(i);
    Login login;
    login.userName = settings.value("userName").toString();
    login.password = settings.value("password").toString();
    logins.append(login);
}
settings.endArray();

Use beginWriteArray() to write the array in the first place.

See also beginWriteArray(), endArray(), and setArrayIndex().

Upstream PySide2 reference signatures (binding differences may apply):

beginReadArray(self, prefix: str) -> int

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

beginWriteArray

beginWriteArray(prefix: str, size: int) -> None

X.beginWriteArray(prefix, size)

Supplemental documentation: Qt 5 reference:

void QSettings::beginWriteArray(const QString \&prefix, int size \= -1)

Adds prefix to the current group and starts writing an array of size size. If size is -1 (the default), it is automatically determined based on the indexes of the entries written.

If you have many occurrences of a certain set of keys, you can use arrays to make your life easier. For example, let's suppose that you want to save a variable-length list of user names and passwords. You could then write:

struct Login {
    QString userName;
    QString password;
};
QList<Login> logins;
...

QSettings settings;
settings.beginWriteArray("logins");
for (int i = 0; i < logins.size(); ++i) {
    settings.setArrayIndex(i);
    settings.setValue("userName", list.at(i).userName);
    settings.setValue("password", list.at(i).password);
}
settings.endArray();

The generated keys will have the form

  • logins/size
  • logins/1/userName
  • logins/1/password
  • logins/2/userName
  • logins/2/password
  • logins/3/userName
  • logins/3/password
  • ...

To read back an array, use beginReadArray().

See also beginReadArray(), endArray(), and setArrayIndex().

Upstream PySide2 reference signatures (binding differences may apply):

beginWriteArray(self, prefix: str, size: int=...) -> None

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

childGroups

childGroups() -> tuple

X.childGroups() -> tuple

Supplemental documentation: Qt 5 reference:

QStringList QSettings::childGroups() const

Returns a list of all key top-level groups that contain keys that can be read using the QSettings object.

Example:

QSettings settings;
settings.setValue("fridge/color", QColor(Qt::white));
settings.setValue("fridge/size", QSize(32, 96));
settings.setValue("sofa", true);
settings.setValue("tv", false);

QStringList groups = settings.childGroups();
// groups: ["fridge"]

If a group is set using beginGroup(), the first-level keys in that group are returned, without the group prefix.

settings.beginGroup("fridge");
groups = settings.childGroups();
// groups: []

You can navigate through the entire setting hierarchy using childKeys() and childGroups() recursively.

See also childKeys() and allKeys().

Upstream PySide2 reference signatures (binding differences may apply):

childGroups(self) -> typing.List[str]

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

childKeys

childKeys() -> tuple

X.childKeys() -> tuple

Supplemental documentation: Qt 5 reference:

QStringList QSettings::childKeys() const

Returns a list of all top-level keys that can be read using the QSettings object.

Example:

QSettings settings;
settings.setValue("fridge/color", QColor(Qt::white));
settings.setValue("fridge/size", QSize(32, 96));
settings.setValue("sofa", true);
settings.setValue("tv", false);

QStringList keys = settings.childKeys();
// keys: ["sofa", "tv"]

If a group is set using beginGroup(), the top-level keys in that group are returned, without the group prefix:

settings.beginGroup("fridge");
keys = settings.childKeys();
// keys: ["color", "size"]

You can navigate through the entire setting hierarchy using childKeys() and childGroups() recursively.

See also childGroups() and allKeys().

Upstream PySide2 reference signatures (binding differences may apply):

childKeys(self) -> typing.List[str]

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

clear

clear() -> None

X.clear()

Supplemental documentation: Qt 5 reference:

void QSettings::clear()

Removes all entries in the primary location associated to this QSettings object.

Entries in fallback locations are not removed.

If you only want to remove the entries in the current group(), use remove("") instead.

See also remove() and setFallbacksEnabled().

Upstream PySide2 reference signatures (binding differences may apply):

clear(self) -> None

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

contains

contains(key: str) -> bool

X.contains(key) -> bool

Supplemental documentation: Qt 5 reference:

bool QSettings::contains(const QString \&key) const

Returns true if there exists a setting called key; returns false otherwise.

If a group is set using beginGroup(), key is taken to be relative to that group.

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 value() and setValue().

Upstream PySide2 reference signatures (binding differences may apply):

contains(self, key: str) -> bool

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

defaultFormat

defaultFormat() -> Any

X.defaultFormat()

Supplemental documentation: Qt 5 reference:

[static] QSettings::Format QSettings::defaultFormat()

Returns default file format used for storing settings for the QSettings(QObject *) constructor. If no default format is set, QSettings::NativeFormat is used.

This function was introduced in Qt 4.4.

See also setDefaultFormat() and format().

Upstream PySide2 reference signatures (binding differences may apply):

defaultFormat() -> PySide2.QtCore.QSettings.Format

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

destroyed

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

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

endArray

endArray() -> None

X.endArray()

Supplemental documentation: Qt 5 reference:

void QSettings::endArray()

Closes the array that was started using beginReadArray() or beginWriteArray().

See also beginReadArray() and beginWriteArray().

Upstream PySide2 reference signatures (binding differences may apply):

endArray(self) -> None

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

endGroup

endGroup() -> None

X.endGroup()

Supplemental documentation: Qt 5 reference:

void QSettings::endGroup()

Resets the group to what it was before the corresponding beginGroup() call.

Example:

settings.beginGroup("alpha");
// settings.group() == "alpha"

settings.beginGroup("beta");
// settings.group() == "alpha/beta"

settings.endGroup();
// settings.group() == "alpha"

settings.endGroup();
// settings.group() == ""

See also beginGroup() and group().

Upstream PySide2 reference signatures (binding differences may apply):

endGroup(self) -> None

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

event

event(event: Any) -> bool

X.event(event) -> bool

Supplemental documentation: Qt 5 reference:

[override virtual protected] bool QSettings::event(QEvent *event)

Reimplements: QObject::event(QEvent *e).

Upstream PySide2 reference signatures (binding differences may apply):

event(self, event: PySide2.QtCore.QEvent) -> bool

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

fallbacksEnabled

fallbacksEnabled() -> bool

X.fallbacksEnabled() -> bool

Supplemental documentation: Qt 5 reference:

bool QSettings::fallbacksEnabled() const

Returns true if fallbacks are enabled; returns false otherwise.

By default, fallbacks are enabled.

See also setFallbacksEnabled().

Upstream PySide2 reference signatures (binding differences may apply):

fallbacksEnabled(self) -> bool

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