I use Qt 4.8.7. I have enum Color {red, green, blue}
and QSet<Color>
. How should I (de)serialize QSet<Color>
using QDataStream
? Deserialization fails with custom type. Should I manually create serialization (loop over QSet elements) besides deserialization? I mean that internal serialization implementation for QSet in theory can be changed by Qt developers, so I have to write two loops for serialization/deserialization by myself.
Asked
Active
Viewed 344 times
0

ilya
- 1,103
- 14
- 36
1 Answers
0
You can use the following cast for deserialization in order to avoid creating manual loops:
data_stream >> reinterpret_cast<QSet<qint32>&>(color_set2);

ilya
- 1,103
- 14
- 36