Qt Model Utilities
2.0.3
A set of utilities for the model/view framework of Qt
|
Serialiser to save and load models in XML format. More...
Public Member Functions | |
XmlModelSerialiser (const QAbstractItemModel *model, QObject *parent) | |
XmlModelSerialiser (QAbstractItemModel *model, QObject *parent) | |
XmlModelSerialiser (QObject *parent=Q_NULLPTR) | |
~XmlModelSerialiser () | |
bool | loadModel (const QByteArray &source) Q_DECL_OVERRIDE |
bool | loadModel (QIODevice *source) Q_DECL_OVERRIDE |
bool | loadModel (QString *source) Q_DECL_OVERRIDE |
virtual bool | loadModel (QXmlStreamReader &stream) |
bool | printStartDocument () const |
bool | saveModel (QByteArray *destination) const Q_DECL_OVERRIDE |
bool | saveModel (QIODevice *destination) const Q_DECL_OVERRIDE |
bool | saveModel (QString *destination) const Q_DECL_OVERRIDE |
virtual bool | saveModel (QXmlStreamWriter &stream) const |
void | setPrintStartDocument (bool val) |
![]() | |
AbstractStringSerialiser (const QAbstractItemModel *model, QObject *parent) | |
AbstractStringSerialiser (QAbstractItemModel *model, QObject *parent) | |
AbstractStringSerialiser (QObject *parent=Q_NULLPTR) | |
virtual | ~AbstractStringSerialiser ()=0 |
Q_INVOKABLE bool | loadModel (const QString &source) |
![]() | |
AbstractModelSerialiser (const QAbstractItemModel *model, QObject *parent) | |
AbstractModelSerialiser (QAbstractItemModel *model, QObject *parent) | |
AbstractModelSerialiser (QObject *parent=Q_NULLPTR) | |
virtual | ~AbstractModelSerialiser ()=0 |
virtual Q_INVOKABLE void | addRoleToSave (int role) |
Appends role to the list of roles to save. More... | |
virtual Q_INVOKABLE void | clearRoleToSave () |
empties the list of roles to save More... | |
virtual const QAbstractItemModel * | constModel () const |
virtual QAbstractItemModel * | model () const |
virtual Q_INVOKABLE void | removeRoleToSave (int role) |
Removes role from the list of roles to save. More... | |
virtual void | resetRoleToSave () |
resetter of rolesToSave property More... | |
virtual const QList< int > & | rolesToSave () const |
void | setModel (const QAbstractItemModel *val) |
void | setModel (QAbstractItemModel *val) |
virtual void | setRoleToSave (const QList< int > &val) |
Q_INVOKABLE QDataStream::Version | streamVersion () const |
The datastream version used to serialise binary data. More... | |
Protected Member Functions | |
XmlModelSerialiser (XmlModelSerialiserPrivate &d, QObject *parent) | |
![]() | |
AbstractStringSerialiser (AbstractStringSerialiserPrivate &d, QObject *parent) | |
![]() | |
AbstractModelSerialiser (AbstractModelSerialiserPrivate &d, QObject *parent) | |
Properties | |
bool | printStartDocument |
This property determines if the start of the xml document should be written. More... | |
![]() | |
const QAbstractItemModel * | constModel |
The model over which the serialiser will operate in read mode. More... | |
QAbstractItemModel * | model |
The model over which the serialiser will operate for reading/writing. More... | |
QList< int > | rolesToSave |
The roles that will be serialised. More... | |
Additional Inherited Members | |
![]() | |
void | setStreamVersion (QDataStream::Version ver) |
Set the datastream version used to serialise binary data. More... | |
![]() | |
static QList< int > | modelDefaultRoles () |
Serialiser to save and load models in XML format.
|
explicit |
Constructs a serialiser
XmlModelSerialiser::XmlModelSerialiser | ( | QAbstractItemModel * | model, |
QObject * | parent | ||
) |
Constructs a serialiser operating over model
XmlModelSerialiser::XmlModelSerialiser | ( | const QAbstractItemModel * | model, |
QObject * | parent | ||
) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
the model will only be allowed to be saved, not loaded
|
default |
Destructor
|
virtual |
Reimplemented from base class
Implements AbstractModelSerialiser.
|
virtual |
Reimplemented from base class
Implements AbstractModelSerialiser.
|
virtual |
Reimplemented from base class
Implements AbstractStringSerialiser.
|
virtual |
Loads the model from the given stream
Data previously stored in the model will be removed
|
virtual |
Reimplemented from base class
Implements AbstractModelSerialiser.
|
virtual |
Reimplemented from base class
Implements AbstractModelSerialiser.
|
virtual |
Reimplemented from base class
Implements AbstractStringSerialiser.
|
virtual |
Saves the model to the given stream
|
readwrite |
This property determines if the start of the xml document should be written.
If this property is set to true
(the default) the serialiser will write the <
?xml> starting block. Set this to false to save the model as part of a larger xml document