Qt Model Utilities
2.0.3
A set of utilities for the model/view framework of Qt
|
The interface for model serialisers. More...
Public Slots | |
void | setStreamVersion (QDataStream::Version ver) |
Set the datastream version used to serialise binary data. More... | |
Public Member Functions | |
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 Q_INVOKABLE bool | loadModel (const QByteArray &source)=0 |
virtual Q_INVOKABLE bool | loadModel (QIODevice *source)=0 |
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 |
virtual Q_INVOKABLE bool | saveModel (QByteArray *destination) const =0 |
virtual Q_INVOKABLE bool | saveModel (QIODevice *destination) const =0 |
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... | |
Static Public Member Functions | |
static QList< int > | modelDefaultRoles () |
Protected Member Functions | |
AbstractModelSerialiser (AbstractModelSerialiserPrivate &d, QObject *parent) | |
Properties | |
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... | |
The interface for model serialisers.
This class serve as a base for all serialisers
|
explicit |
Constructs a serialiser
AbstractModelSerialiser::AbstractModelSerialiser | ( | QAbstractItemModel * | model, |
QObject * | parent | ||
) |
Constructs a serialiser operating over model
AbstractModelSerialiser::AbstractModelSerialiser | ( | 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
|
pure virtualdefault |
Destructor
|
virtual |
Appends role to the list of roles to save.
Reimplemented in AbstractSingleRoleSerialiser.
|
virtual |
empties the list of roles to save
Reimplemented in AbstractSingleRoleSerialiser.
|
pure virtual |
Loads the model from the given source
Data previously stored in the model will be removed
Implemented in XmlModelSerialiser, JsonModelSerialiser, HtmlModelSerialiser, CsvModelSerialiser, and BinaryModelSerialiser.
|
pure virtual |
Loads the model from the given source
Data previously stored in the model will be removed
Implemented in XmlModelSerialiser, JsonModelSerialiser, HtmlModelSerialiser, CsvModelSerialiser, and BinaryModelSerialiser.
|
static |
Returns a list of all non-obsolete Qt::ItemDataRole values
|
virtual |
Removes role from the list of roles to save.
Reimplemented in AbstractSingleRoleSerialiser.
|
virtual |
resetter of rolesToSave property
fills the list fo roles to save with all non obsolete Qt::ItemDataRole values
Reimplemented in AbstractSingleRoleSerialiser.
|
pure virtual |
Saves the model to the given destination
Implemented in XmlModelSerialiser, JsonModelSerialiser, HtmlModelSerialiser, CsvModelSerialiser, and BinaryModelSerialiser.
|
pure virtual |
Saves the model to the given destination
Implemented in XmlModelSerialiser, JsonModelSerialiser, HtmlModelSerialiser, CsvModelSerialiser, and BinaryModelSerialiser.
void AbstractModelSerialiser::setModel | ( | const QAbstractItemModel * | val | ) |
Sets the model over which the serialiser will operate in read mode
Using this method will only allow the model to be saved, not loaded
|
slot |
Set the datastream version used to serialise binary data.
This will be used to serialise variants that have a binary-only representation. By default this property is set to the latest version avaliable in Qt.
QDataStream::Version AbstractModelSerialiser::streamVersion | ( | ) | const |
The datastream version used to serialise binary data.
This will be used to serialise variants that have a binary-only representation. By default this property is set to the latest version avaliable in Qt.
|
readwrite |
The model over which the serialiser will operate in read mode.
|
readwrite |
The model over which the serialiser will operate for reading/writing.
If setModel(const QAbstractItemModel*) was used to se the model, this method will return nullptr
|
readwrite |
The roles that will be serialised.
By default this property is set to all non obsolete Qt::ItemDataRole values