Revision 5ae606bb
Von Christian Ehringfeld vor etwa 8 Jahren hinzugefügt
src/entity.cpp | ||
---|---|---|
return "id";
|
||
}
|
||
|
||
QHash<QString, QVariant> Entity::getProperties() {
|
||
auto count = this->metaObject()->propertyCount();
|
||
QHash<QString, QVariant> hash = QHash<QString, QVariant>();
|
||
for (int i = 0; i < count; ++i) {
|
||
auto prop = this->metaObject()->property(i);
|
||
hash.insert(QString(prop.name()),prop.read(this));
|
||
}
|
||
return hash;
|
||
}
|
||
|
||
QHash<QString, QString> Entity::getPropertyLabels() {
|
||
QHash<QString, QString> hash = QHash<QString, QString>();
|
||
hash.insert("id","ID");
|
||
return hash;
|
||
}
|
||
|
||
QVariant Entity::getProperty(const QString &name) const {
|
||
if (!name.isEmpty()) {
|
||
return QObject::property(name.toLatin1().constData());
|
src/entity.h | ||
---|---|---|
virtual bool isInheritanceCascaded() const;
|
||
//return value must be the exact name defined in Q_PROPERTY
|
||
virtual QString getPrimaryKey() const;
|
||
virtual QHash<QString, QVariant> getProperties();
|
||
virtual QHash<QString, QString> getPropertyLabels();
|
||
|
||
QVariant getProperty(const QString &name) const;
|
||
bool setProperty(const QString &name, const QVariant &value);
|
Auch abrufbar als: Unified diff
added methods