All Classes Functions Typedefs Enumerations Enumerator Properties Groups Pages
QDjangoMetaModel Class Reference

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 | createTable () const
| Creates the database table for this QDjangoMetaModel.
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.
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...
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.

## Detailed Description

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.

## Member Function Documentation

QObject * QDjangoMetaModel::foreignKey | ( | const QObject * | model,
|  | const char * | name
| ) |  | const

Retrieves the QDjangoModel pointed to by the given foreign-key.

Parameters

  model |
  name |

bool QDjangoMetaModel::save | ( | QObject * | model) |  | const

Saves the given model instance to the database.

Returns
  true if saving succeeded, false otherwise

void QDjangoMetaModel::setForeignKey | ( | QObject * | model,
|  | const char * | name,
|  | QObject * | value
| ) |  | const

Sets the QDjangoModel pointed to by the given foreign-key.

Parameters

  model |
  name |
  value |

The documentation for this class was generated from the following files:

- QDjangoMetaModel.h
- QDjangoMetaModel.cpp