[PySide] pickling enums (again)

lloyd konneker bootch at nc.rr.com
Fri Apr 26 16:36:04 CEST 2013


I know this is not a high priority and has been visited before.

1) I posted an unreliable workaround at
https://bugreports.qt-project.org/browse/PYSIDE-15 (unreliable since
dict.keys() is arbitrarily ordered?)

2) Is pickling of Qt enums working in PyQt and just needs someone to port it
to PySide?  (If so, I might try.)

3) In a previous post http://article.gmane.org/gmane.comp.lib.qt.pyside/1083
Hugo objected to allowing type int in Qt methods where a type Qt enum was
expected.  IMHO that is too strong and unPythonic.  It is not always the
duty of PySide to enforce type checking.  Especially since enums in C++ are
not very strict (allow comparison to ints, allow comparison between
different enum types, etc.  See discussions of "enum class" for C++11.) 
Maybe relaxing enforcement for those methods that take parameters of type Qt
enum where the enum is a subclass of int would allow easier unpickling of Qt
enums (But not all Qt enums such as Qt.GlobalColor are subclasses of int?) 
And maybe there is a better solution.




More information about the PySide mailing list