[Interest] Serializing QSensorReading derived classes
Jason H
jhihn at gmx.com
Wed Feb 21 07:05:35 CET 2018
I'd like to serialize these values.
QAcceleromterReading has x,y,z properties, but to serialize this one, the accelerometer mode should also be included.
But aside from that, I'm not clear on what I need to do. There's adding the QDataStream << >> (QDataScream stream, QSensorReading reading) operators. But that won't allow me to know what I'm reading, so I need to add a byte to know what I'm deserializing, which means I should really do it via QVariant in the QMetaType system.
qRegisterMetaType() and DECLARE_META_TYPE(). However, when I do this I get:
qmetatype.h:766: error: call to implicitly-deleted copy constructor of 'QAltimeterReading'
return new (where) T(*static_cast<const T*>(t));
^ ~~~~~~~~~~~~~~~~~~~~~~~~~
for each of the types.
What can I do to get this to work without having to write (derive) my own classes?
I'm also wondering why this isn't supported already?
More information about the Interest
mailing list