[Interest] QDatastream, QMap, QImage serialization

Thiago Macieira thiago.macieira at intel.com
Sun May 20 17:54:02 CEST 2018


On Sunday, 20 May 2018 07:26:47 -03 Konstantin Shegunov wrote:
> On Thu, May 17, 2018 at 5:58 PM, Thiago Macieira <thiago.macieira at intel.com>
> wrote:
> > On Thursday, 17 May 2018 05:01:18 PDT Jean-Michaƫl Celerier wrote:
> > > Is there a reason why calling qRegisterStreamOperators<QImage>() would't
> > > work ?
> > 
> > Because the vector containng the list of function pointers doesn't exist
> > for
> > metatypes < QMetaType::User.
> 
> Is this by design, or just an unfortunate legacy?

It's by design that the vector starts at QMetaType::User.

> I would've expected
> (obviously wrongly) that the core classes provide and support all the
> functionalities of properly registered custom types.

Except where it was too hard and we haven't done it. Serialisation appears to 
be one such case.

> And a follow up question: I'm not intimate with the internals, so is it
> feasible to actually bring this to consistency and have the stream
> operators registered in the meta-type system for the core classes?

Yes. Patch accepted. See qguivariant.cpp: the two save and load functions are 
currently null pointers. Replace with actual functions that save QtGui types 
to a QDataStream and properly loaded back.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center






More information about the Interest mailing list