diff options
author | Cristián Maureira-Fredes <cristian.maureira-fredes@qt.io> | 2019-05-29 11:22:44 +0200 |
---|---|---|
committer | Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> | 2019-07-17 10:47:31 +0200 |
commit | 78dad8180d797a647645b74255bfc29c46d7264a (patch) | |
tree | fa35a636fb31d0e0b56bb3acdbd56f123526a179 /sources/pyside2/tests/QtQml/bug_926.qml | |
parent | 4905e2e2feacd346c2f781aa817b3d13ace3411d (diff) |
Add optional support for types in QSettings::value
This add 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"]
The cppgenerator was modified to add a verification step
before trying to get the named parameter, since it could
be optional and having one named parameter was assumming
that all of them were provided.
Change-Id: I8f379debea86b42cf89019d432e990084c9e6614
Fixes: PYSIDE-1010
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Christian Tismer <tismer@stackless.com>
Diffstat (limited to 'sources/pyside2/tests/QtQml/bug_926.qml')
0 files changed, 0 insertions, 0 deletions