[Qt-interest] How to deal with pointers for a QDataStream?

Oliver Heins heins at sopos.org
Tue Apr 20 12:22:15 CEST 2010


Thiago Macieira <thiago at kde.org> writes:

> Em Segunda-feira 19 Abril 2010, às 14:41:45, Oliver Heins escreveu:
>
>> As saving pointers directly to a QDataStream will obviously not work,
>> what would be a good strategy to save the structure?
>
> Save pointed-to children, then restore it later by creating objects.
>
> I don't think it makes sense to save the parent. Instead, the parent
> should set itself in its children when loading them.
>
> As for the partners, it's your structure. Probably the parent should
> save the partnership relations after the children stream and then set
> them after loading them.

Thiago, thank you for your answer.  However, I don't think this is the
way to go.  Instead, I'll gonna drop the children list.  Building a
model with recursion will need properly nested elements, which I don't
have.  I have to deal with data organized  like this:

This <a>is <b>a <c>silly</a> test</b>, a blindtext</c>. 

Best regards,
 olli



More information about the Qt-interest-old mailing list