Skip to content

Latest commit

 

History

History
27 lines (18 loc) · 863 Bytes

READMEModelSerialisation.md

File metadata and controls

27 lines (18 loc) · 863 Bytes

Model Serialisation

Implements a general method to serialise QAbstractItemModel based models to various common formats.

Custom Types

To save custom classes stored in the model as QVariants you will need to define and register their stream operators. For example, for class MyClass you will need to implement

QDataStream& operator<<(QDataStream &stream, const MyClass& val);
QDataStream& operator>>(QDataStream & stream, MyClass& val);

And resgister them before using any save/load functionality by calling

qRegisterMetaType<MyClass>("MyClass");
qRegisterMetaTypeStreamOperators<MyClass>("MyClass");

Class Documentation

  • BinaryModelSerialiser
  • CsvModelSerialiser
  • HtmlModelSerialiser
  • JsonModelSerialiser
  • XmlModelSerialiser

Dependencies

  • Qt Core
  • Qt Gui (Optional to allow saving images in human-visible format)