[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    Re: [PyKDE] Using QDataStream
From:       James Emerton <james () emdata ! net>
Date:       2005-04-06 17:08:19
Message-ID: 3f2a7829644d869d0e95bb74f760f852 () emdata ! net
[Download RAW message or body]

You may be able to exploit the Qt properties system to retrieve the 
most interesting members.  (Provided that the parts interesting to you 
are actually properties.)

# Saving...
props = { }
for p in obj.metaClass().propertyNames( True ):
     props[ p ] = obj.property( p )

# Loading...
for p, v in props.iteritems():
     obj.setProperty( p, v )


Of course, this is all of the top of my head and before my coffee has 
had a chance to kick in.

James


On 5-Apr-05, at 5:39 PM, Eron Lloyd wrote:

> Hello again,
>
> 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...
>
> Thanks,
>
> Eron
>
> _______________________________________________
> PyKDE mailing list    PyKDE@mats.imk.fraunhofer.de
> http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
>
--
This is not my home; the cats just let me stay here.

_______________________________________________
PyKDE mailing list    PyKDE@mats.imk.fraunhofer.de
http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic