The QDjangoMetaModel class holds the database schema for a model. More...
#include <QDjangoMetaModel.h>
Public Member Functions | |
| QDjangoMetaModel (const QObject *model=0) | |
| Constructs a new QDjangoMetaModel by inspecting the given model instance. | |
| 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 | createTable () const |
| Creates the database table for this QDjangoMetaModel. | |
| bool | dropTable () const |
| Drops the database table for this QDjangoMetaModel. | |
| 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. | |
| QObject * | foreignKey (const QObject *model, const char *name) const |
| Retrieves the QDjangoModel pointed to by the given foreign-key. | |
| void | setForeignKey (QObject *model, const char *name, QObject *value) const |
| Sets the QDjangoModel pointed to by the given foreign-key. | |
| QDjangoMetaField | localField (const QString &name) const |
| Return the local field with the specified name. | |
| QList< QDjangoMetaField > | localFields () const |
| Returns the list of local fields. | |
| QMap< QByteArray, QString > | 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.
| 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 |
model will take ownership of the given value.
1.8.1.2