You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Just had the rare case of having corrupt data in one of my settings. In this specific case it was the mapping of QButtonGroup where the default value is something like [[0, True], [1, False], [2, False]]. But somehow I managed to save [None, [None]] as my settings value. Now everytime I try to add the handler for my ButtonGroup I get following error:
The only way I could help myself was to use another name for the setting. As the exception occurs in _set_QButtonGroup I thought about wrapping it in a try ... except right there.
def_set_QButtonGroup(self, v):
""" Set the states for all buttons in a group from a list of (index, checked) tuples """try:
foridx, stateinv:
self.buttons()[idx].setChecked(state)
exceptTypeError:
pass
The text was updated successfully, but these errors were encountered:
stlehmann
changed the title
Getting stuck with wrong type in QSettingsManager
Getting stuck with corrupt setting data for QButtonGroup in QSettingsManager
Jul 30, 2015
Thanks for this 👍 Do you know how that value ended up in there?
It probably makes sense to wrap this further up (in the manager itself) so it works for all widgets in case of error. Also worth raising a warning that the set has failed so it shows up in logs.
I have no idea how it ended up there. I was playing around with the code of my application a bit but I can' t remember. However it is easily possible that a setting gets corrupted somehow, e.g. by direct manipulation via set(). So it definetly makes sense to wrap it up in the manager for other widgets as well. Returning the default value in case of an error would make sense to me.
Just had the rare case of having corrupt data in one of my settings. In this specific case it was the mapping of QButtonGroup where the default value is something like
[[0, True], [1, False], [2, False]]
. But somehow I managed to save[None, [None]]
as my settings value. Now everytime I try to add the handler for my ButtonGroup I get following error:The only way I could help myself was to use another name for the setting. As the exception occurs in _set_QButtonGroup I thought about wrapping it in a
try ... except
right there.The text was updated successfully, but these errors were encountered: