Details
Description
In this case, I get the error : "TypeError: can't pickle PenStyle objects".
Since under the hood these enum values are just integers, I would imagine that implementing pickling shouldn't be too hard, and would be very useful.
One thing that confuses me is that pickling fails, but I can use Qt.SolidLine as a key in a dictionary, which is usually only possible with pickleable objects, so maybe enum values are supposed to be pickleable and this is actually a bug? :
from PySide2.QtCore import * d = { Qt.SolidLine : "Solid"} d.keys() [PySide.QtCore.Qt.PenStyle.SolidLine] import StringIO import pickle sio = StringIO.StringIO() pickle.dump(Qt.SolidLine, sio) Traceback (most recent call last): File "<pyshell#20>", line 1, in <module> pickle.dump(Qt.SolidLine, sio) File "C:\Python27\lib\pickle.py", line 1370, in dump Pickler(file, protocol).dump(obj) File "C:\Python27\lib\pickle.py", line 224, in dump self.save(obj) File "C:\Python27\lib\pickle.py", line 306, in save rv = reduce(self.proto) File "C:\Python27\lib\copy_reg.py", line 70, in _reduce_ex raise TypeError, "can't pickle %s objects" % base.__name__ TypeError: can't pickle PenStyle objects