QDjango
Public Member Functions
QDjangoMetaModel Class Reference

The QDjangoMetaModel class holds the database schema for a model. More...

#include <QDjangoMetaModel.h>

List of all members.

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.
QDjangoMetaModeloperator= (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< QDjangoMetaFieldlocalFields () 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.

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
Note:
The model will take ownership of the given value.

The documentation for this class was generated from the following files:
 All Classes Functions Typedefs Enumerations Enumerator Properties