PySide6
QSettings
does not expose registerFormat()
https://doc.qt.io/qtforpython-6/PySide6/QtCore/QSettings.html
Is there a way, say with QT
QMetaObject
or with python
ctypes
,
still, to invoke registerFormat()
from python?
PySide6
QSettings
does not expose registerFormat()
https://doc.qt.io/qtforpython-6/PySide6/QtCore/QSettings.html
Is there a way, say with QT
QMetaObject
or with python
ctypes
,
still, to invoke registerFormat()
from python?
Hi @random_hacker
hmmmm… looks like it is: QSettings Class | Qt Core 6.8.1
I do not see, that it is missing as well: Qt for Python Missing Bindings - Qt Wiki
Edit: I never find QSettings
useful, more clunky. I just use good old YAML file and store in user home directory. Then is easy to me check settings at start and make migration when some I add, remove or change parameter name.
@Michal_Plichta, thank you.
registerFormat()
is in fact missing in PySide6
.cpp
PySide6
the result of QtCore.QSettings.registerFormat(...)
is:AttributeError:
type object 'PySide6.QtCore.QSettings'
has no attribute 'registerFormat'
“good old YAML” usually means PyYAML · PyPI
which is indeed good, but is not a part of python
stdlib
and also requires binary build during pip install
since it comes with c
code
the task at hand is to avoid file-based store,
and use memory-store instead, which in turn is persisted by other means
Ot got it… I’m not so familiar with QSettings
So, you want introduce your own format for storing app setting and for some reason you don’t want use
NativeFormat
or IniFormat
PySide6.QtCore.QSettings.Format ?
yes, need to provide for QSettings
custom call backs:
ReadFunc(...)
WriteFunc(...)
Probably you can use cffi
or ctypes
to write Python wrapper to C++ Qt6 library, but for me looks like overkill for such functionality.
On windows you need Qt6Core.dll
and different lib on Linux, there are different way to handling native C/C++ library under different OS so introduce some layer of abstraction is needed… but even if you want to produce only support only one OS… I wouldn’t go that route…