Nevermind me. That's not true either.
 
I don't know what I changed, but it just started working this morning.
 
Sent: Thursday, May 17, 2018 at 10:11 AM
From: "Jason H" <jh...@gmx.com>
To: "Jason H" <jh...@gmx.com>
Cc: "Jean-Michaël Celerier" <jeanmichael.celer...@gmail.com>, "Thiago Macieira" <thiago.macie...@intel.com>, interest <interest@qt-project.org>
Subject: Re: [Interest] QDatastream, QMap, QImage serialization
So it looks like it actually works! I was mistaken.
 
My mistake was in that thinking I can just change QVariantMaps down the tree. When I modify a Map in a Map, it looks like it detaches, and I have to back-patch  to the root map. 
 
Given:
map1["a"]=map2;
map2["b"]=map3;
 
map3["image"]= image; // map3 is a copy and modified map3
// now patch backards:  
map2["b"]=map3;  // set it to the modified map3
map1["a"]=map2;  // set it to the modified map2
 
Then it shows up in the output.
 
Is there a way to avoid having to manually back-patch it?
 
Sent: Thursday, May 17, 2018 at 9:51 AM
From: "Jason H" <jh...@gmx.com>
To: "Jean-Michaël Celerier" <jeanmichael.celer...@gmail.com>
Cc: "Thiago Macieira" <thiago.macie...@intel.com>, interest <interest@qt-project.org>
Subject: Re: [Interest] QDatastream, QMap, QImage serialization
I'm not familar with that function,  but I would guess because it's a QVariant holding a QImage?
There already are those stream operators, and I think they are already registered.
 
I'm not understanding why QVariatn doesn't know how/why to call it?
I'd figure that QVariant would write the type, the 0 byte, then have the object QDataStream& operator << into the QIODevice itself?
 
Sent: Thursday, May 17, 2018 at 8:02 AM
From: "Jean-Michaël Celerier" <jeanmichael.celer...@gmail.com>
To: "Jean-Michaël Celerier" <jeanmichael.celer...@gmail.com>
Cc: "Thiago Macieira" <thiago.macie...@intel.com>, interest <interest@qt-project.org>
Subject: Re: [Interest] QDatastream, QMap, QImage serialization
Sorry, I meant qRegisterMetaTypeStreamOperators<QImage>()
 
 
 
-------
Jean-Michaël Celerier
 
On Thu, May 17, 2018 at 2:01 PM, Jean-Michaël Celerier <jeanmichael.celer...@gmail.com> wrote:
> The problem is that QVariant doesn't know how to call it.
 
Is there a reason why calling qRegisterStreamOperators<QImage>() would't work ?
 
 
 
-------
Jean-Michaël Celerier
 
On Wed, May 16, 2018 at 11:52 PM, Thiago Macieira <thiago.macie...@intel.com> wrote:
On Wednesday, 16 May 2018 14:38:08 PDT Jérôme Godbout wrote:
> You will need to provide your own
>
> QDataStream& operator<<(QDataStream& ds, const QImage& img)


That's not needed (and won't compile). It already exists.

The problem is that QVariant doesn't know how to call it. So when you have a
QImage inside a QVariant and you try to serialise that QVariant, you get
nothing useful.

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



 
_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest
_______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
_______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to