[review] [PyKDE] Using QDataStream

Jim Bublitz jbublitz at nwinternet.com
Wed Apr 6 07:23:37 BST 2005

On Tuesday 05 April 2005 17:39, Eron Lloyd wrote:

> Since pickle doesn't allow objects wrapping QObjects, I guess QDataStream
> is the next best bet. I haven't found any good examples of it in action, so
> was wondering if anyone has any suggestions. Basically I have a class that
> acts as a data model, and I'd like to store it's members (both python and
> QObjects) as serialized files. I've been spoiled by pickle up 'til now...

You can look at PyKDE/kdecore/bytearray.sip, which creates bindings for 
QDataStream operations for use with DCOP. The methods are dcop_add to put 
data on a QDataStream, and dcop_next to pull it off (but the names aren't 
particularly critical). 

You could add similar code to PyQt/qt, although it would make your PyQt 
non-standard and would be a pain to maintain.

You can probably do it in Python, but it's probably not very easy or pleasant.


More information about the PyQt mailing list