Subgroup: other
Class: QgsSettings¶
-
class
qgis.core.
QgsSettings
¶ Bases:
PyQt5.QtCore.QObject
This class is a composition of two QSettings instances: - the main QSettings instance is the standard User Settings and - the second one (Global Settings) is meant to provide read-only pre-configuration and defaults to the first one.
For a given settings key, the function call to value(key, default) will return the first existing setting in the order specified below: - User Settings - Global Settings - Default Value
The path to the Global Settings storage can be set before constructing the QgsSettings objects, with a static call to: static bool setGlobalSettingsPath( QString path );
QgsSettings provides some shortcuts to get/set namespaced settings from/to a specific section: - Core - Gui - Server - Plugins - Auth - App - Providers - Misc
New in version 3: Methods
allKeys
Returns a list of all keys, including subkeys, that can be read using the QSettings object. beginGroup
Appends prefix to the current group. beginReadArray
Adds prefix to the current group and starts reading from an array. beginWriteArray
Adds prefix to the current group and starts writing an array of size size. blockSignals
childEvent
childGroups
Returns a list of all key top-level groups that contain keys that can be read using the QSettings object. childKeys
Returns a list of all top-level keys that can be read using the QSettings object. children
clear
Removes all entries in the user settings connectNotify
contains
Returns true if there exists a setting called key; returns false otherwise. customEvent
deleteLater
disconnect
disconnectNotify
dumpObjectInfo
dumpObjectTree
dynamicPropertyNames
endArray
Closes the array that was started using beginReadArray() or beginWriteArray(). endGroup
Resets the group to what it was before the corresponding beginGroup() call. event
eventFilter
fileName
Returns the path where settings written using this QSettings object are stored. findChild
findChild(self, Tuple, name: str = ‘’, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> QObject findChildren
findChildren(self, Tuple, name: str = ‘’, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject] globalChildGroups
Returns a list of all key top-level groups (same as childGroups) but only for groups defined in global settings. globalSettingsPath
Return the path to the Global Settings QSettings storage file inherits
installEventFilter
isSignalConnected
isWidgetType
isWindowType
killTimer
metaObject
moveToThread
objectName
parent
prefixedKey
Return the sanitized and prefixed key property
pyqtConfigure
Each keyword argument is either the name of a Qt property or a Qt signal. receivers
remove
Removes the setting key and any sub-settings of key in a section. removeEventFilter
sender
senderSignalIndex
setArrayIndex
Sets the current array index to i. setGlobalSettingsPath
Set the Global Settings QSettings storage file setObjectName
setParent
setProperty
setValue
Sets the value of setting key to value. signalsBlocked
startTimer
sync
Writes any unsaved changes to permanent storage, and reloads any settings that have been changed in the meantime by another application. thread
timerEvent
tr
value
Returns the value for setting key. Attributes
App
Auth
Core
Gui
Misc
NoSection
Plugins
Providers
Server
destroyed
destroyed(self, QObject = None) [signal] objectNameChanged
objectNameChanged(self, str) [signal] staticMetaObject
-
App
= 6¶
-
Auth
= 5¶
-
Core
= 1¶
-
Gui
= 2¶
-
Misc
= 8¶
-
NoSection
= 0¶
-
Plugins
= 4¶
-
Providers
= 7¶
-
class
Section
¶ Bases:
int
-
Server
= 3¶
-
allKeys
(self) → List[str]¶ Returns a list of all keys, including subkeys, that can be read using the QSettings object.
-
beginGroup
(self, prefix: str, section: QgsSettings.Section = QgsSettings.NoSection)¶ 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.
-
beginReadArray
(self, prefix: str) → int¶ Adds prefix to the current group and starts reading from an array. Returns the size of the array.
-
beginWriteArray
(self, prefix: str, size: int = -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.
Note
This will completely shadow any existing array with the same name in the global settings
-
childEvent
()¶
-
childGroups
(self) → List[str]¶ Returns a list of all key top-level groups that contain keys that can be read using the QSettings object.
-
childKeys
(self) → List[str]¶ Returns a list of all top-level keys that can be read using the QSettings object.
-
clear
(self)¶ Removes all entries in the user settings
-
connectNotify
()¶
-
contains
(self, key: str, section: QgsSettings.Section = QgsSettings.NoSection) → bool¶ 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.
-
customEvent
()¶
-
disconnectNotify
()¶
-
endArray
(self)¶ Closes the array that was started using beginReadArray() or beginWriteArray().
-
endGroup
(self)¶ Resets the group to what it was before the corresponding beginGroup() call.
-
fileName
(self) → str¶ Returns the path where settings written using this QSettings object are stored.
-
globalChildGroups
(self) → List[str]¶ Returns a list of all key top-level groups (same as childGroups) but only for groups defined in global settings.
-
globalSettingsPath
() → str¶ Return the path to the Global Settings QSettings storage file
-
isSignalConnected
()¶
-
prefixedKey
(self, key: str, section: QgsSettings.Section) → str¶ Return the sanitized and prefixed key
-
receivers
()¶
-
remove
(self, key: str, section: QgsSettings.Section = QgsSettings.NoSection)¶ Removes the setting key and any sub-settings of key in a section.
-
sender
()¶
-
senderSignalIndex
()¶
-
setArrayIndex
(self, i: int)¶ 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.
-
setGlobalSettingsPath
(path: str) → bool¶ Set the Global Settings QSettings storage file
-
setValue
(self, key: str, value: Any, section: QgsSettings.Section = QgsSettings.NoSection)¶ Sets the value of setting key to value. If the key already exists, the previous value is overwritten. An optional Section argument can be used to set a value to a specific Section.
-
sync
(self)¶ 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.
-
timerEvent
()¶
-
value
(self, key: str, defaultValue: Any = None, type: object = 0, section: QgsSettings.Section = QgsSettings.NoSection) → object¶ Returns the value for setting key. If the setting doesn’t exist, it will be searched in the Global Settings and if not found, returns defaultValue. If no default value is specified, a default QVariant is returned. An optional Section argument can be used to get a value from a specific Section.
-