pyqtconfig
pyqtconfig copied to clipboard
no conversion with QSettingManager
Reagrding: "Note: On some platforms, versions of Qt, or Qt APIs QSettings will return strings for all values which can lead to complicated code and breakage. However, PyQtConfig is smart enough to use the type of the config parameter in defaults to auto-convert returned values. However, you do not have to set defaults manually. As of v0.7 default values are auto-set when attaching widgets (handlers) to the config manager if they're not already set."
Using QSpinBox, it seems that when no default was defined, no conversion is done and a string is send to the setValue which raise an exception. My QSpinBox is created via qtdesigner.
from acquisition_gui import Ui_acquisitionDockWidget
self.ui = Ui_acquisitionDockWidget()
self.ui.setupUi(self)
self.settings = QSettingsManager() self.settings.add_handler("acquisition/record_interval",self.ui.record_interval_spinBox)
self.settings.add_handler("acquisition/number_records",self.ui.number_records_spinBox)