QDjango
|
The QDjangoMetaModel class holds the database schema for a model. More...
#include <QDjangoMetaModel.h>
Public Member Functions | |
QDjangoMetaModel (const QMetaObject *model=0) | |
Constructs a new QDjangoMetaModel by inspecting the given meta model. | |
QDjangoMetaModel (const QDjangoMetaModel &other) | |
Constructs a copy of other. | |
~QDjangoMetaModel () | |
Destroys the meta model. | |
QDjangoMetaModel & | operator= (const QDjangoMetaModel &other) |
Assigns other to this meta model. | |
bool | isValid () const |
Determine whether this is a valid model, or just default constructed. | |
bool | createTable () const |
Creates the database table for this QDjangoMetaModel. More... | |
QStringList | createTableSql () const |
Returns the SQL queries to create the database table for this QDjangoMetaModel. | |
bool | dropTable () const |
Drops the database table for this QDjangoMetaModel. More... | |
void | load (QObject *model, const QVariantList &props, int &pos) const |
Loads the given properties into a model instance. | |
bool | remove (QObject *model) const |
Removes the given model instance from the database. | |
bool | save (QObject *model) const |
Saves the given model instance to the database. More... | |
QObject * | foreignKey (const QObject *model, const char *name) const |
Retrieves the QDjangoModel pointed to by the given foreign-key. More... | |
void | setForeignKey (QObject *model, const char *name, QObject *value) const |
Sets the QDjangoModel pointed to by the given foreign-key. More... | |
QString | className () const |
QDjangoMetaField | localField (const char *name) const |
Return the local field with the specified name. | |
QList< QDjangoMetaField > | localFields () const |
Returns the list of local fields. | |
QMap< QByteArray, QByteArray > | foreignFields () const |
Returns the foreign field mapping. | |
QByteArray | primaryKey () const |
Returns the name of the primary key for the current QDjangoMetaModel. | |
QString | table () const |
Returns the name of the database table. | |
The QDjangoMetaModel class holds the database schema for a model.
It manages table creation and deletion operations as well as row serialisation, deserialisation and deletion operations.
bool QDjangoMetaModel::createTable | ( | ) | const |
Creates the database table for this QDjangoMetaModel.
bool QDjangoMetaModel::dropTable | ( | ) | const |
Drops the database table for this QDjangoMetaModel.
QObject * QDjangoMetaModel::foreignKey | ( | const QObject * | model, |
const char * | name | ||
) | const |
Retrieves the QDjangoModel pointed to by the given foreign-key.
model | |
name |
bool QDjangoMetaModel::save | ( | QObject * | model | ) | const |
Saves the given model instance to the database.
void QDjangoMetaModel::setForeignKey | ( | QObject * | model, |
const char * | name, | ||
QObject * | value | ||
) | const |
Sets the QDjangoModel pointed to by the given foreign-key.
model | |
name | |
value |