0

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.

ilya
  • 1,103
  • 14
  • 36

1 Answers1

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