diff options
author | Cristián Maureira-Fredes <cristian.maureira-fredes@qt.io> | 2021-01-05 11:12:21 +0100 |
---|---|---|
committer | Cristián Maureira-Fredes <cristian.maureira-fredes@qt.io> | 2021-01-05 13:54:53 +0100 |
commit | 9547dc918868470fe00fafe25d74a87b2ed35f1f (patch) | |
tree | 43ee8f2b66696f6e836247d1b6542c0f4ff90e19 /sources/pyside6/PySide6/QtCore/typesystem_core_common.xml | |
parent | 5676675320bd41a9c321e9259962ced923f69757 (diff) |
QSetting.value add overload documentation
When the new overload to specify a new "type" parameter
was included, there was no documentation that could be reflected
in our API docs.
This adds a paragraph/example for the overload introduced by
78dad8180d797a647645b74255bfc29c46d7264a
Fixes: PYSIDE-1466
Pick-to: 6.0
Pick-to: 5.15
Change-Id: I843e650f8eb4c32f4c67a31ed5cf9047c4f171f9
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'sources/pyside6/PySide6/QtCore/typesystem_core_common.xml')
-rw-r--r-- | sources/pyside6/PySide6/QtCore/typesystem_core_common.xml | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/sources/pyside6/PySide6/QtCore/typesystem_core_common.xml b/sources/pyside6/PySide6/QtCore/typesystem_core_common.xml index 91d8c3e63..d0bb7ee32 100644 --- a/sources/pyside6/PySide6/QtCore/typesystem_core_common.xml +++ b/sources/pyside6/PySide6/QtCore/typesystem_core_common.xml @@ -2419,6 +2419,27 @@ <modify-function signature="value(const QString&,const QVariant&)const" remove="all"/> <add-function signature="value(const QString&, const QVariant& @defaultValue@ = 0, PyObject* @type@ = 0)" return-type="PyObject*"> <inject-code class="target" position="beginning" file="../glue/qtcore.cpp" snippet="qsettings-value"/> + <inject-documentation mode="append" format="target"> + Custom overload that adds an optional named parameter to the function ``value()`` + to automatically cast the type that is being returned by the function. + + An example of this situation could be an ini file that contains + the value of a one-element list:: + + settings.setValue('var', ['a']) + + The the ini file will be:: + + [General] + var=a # we cannot know that this is a list! + + Once we read it, we could specify if we want + the default behavior, a str, or to cast the output + to a list. + + settings.value('var') # Will get "a" + settings.value('var', type=list) # Will get ["a"] + </inject-documentation> </add-function> </object-type> <object-type name="QEvent" polymorphic-id-expression="%1->type() == QEvent::None"> |