QDjangoModel.h
/*
* Copyright (C) 2010-2015 Jeremy Lainé
* Contact: https://github.com/jlaine/qdjango
*
* This file is part of the QDjango Library.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*/
#ifndef QDJANGO_MODEL_H
#define QDJANGO_MODEL_H
#include <QObject>
#include <QVariant>
#include "QDjango_p.h"
class QDJANGO_DB_EXPORT QDjangoModel : public QObject
{
Q_OBJECT
Q_PROPERTY(QVariant pk READ pk WRITE setPk)
Q_CLASSINFO("pk", "ignore_field=true")
public:
QDjangoModel(QObject *parent = 0);
QVariant pk() const;
void setPk(const QVariant &pk);
public slots:
bool remove();
bool save();
QString toString() const;
protected:
QObject *foreignKey(const char *name) const;
void setForeignKey(const char *name, QObject *value);
};
#endif
QDjangoModel
The QDjangoModel class is the base class for all models.
Definition: QDjangoModel.h:79