Revision 6e6097fb
Von Christian Ehringfeld vor etwa 9 Jahren hinzugefügt
| src/entityhelper.cpp | ||
|---|---|---|
|
return QString(entity->metaObject()->className());
|
||
|
}
|
||
|
|
||
|
#include <QDebug>
|
||
|
|
||
|
void EntityHelper::setListProperty(const QSharedPointer<Entity> &entity,
|
||
|
QList<QSharedPointer<Entity>> &list,
|
||
|
const QMetaProperty &property) {
|
||
|
QVariant var;
|
||
|
var.setValue<QList<QSharedPointer<Entity>>>(list);
|
||
|
property.write(entity.data(), var);
|
||
|
qDebug() << "<ab>" << entity->setProperty(property.name(),var);
|
||
|
//property.write(entity.data(), var);
|
||
|
}
|
||
|
|
||
|
void EntityHelper::addEntityToListProperty(const QSharedPointer<Entity>
|
||
| ... | ... | |
|
var) : QList<QSharedPointer<Entity>>());
|
||
|
if (!list.contains(add)) {
|
||
|
list.append(add);
|
||
|
EntityHelper::setListProperty(entity, list, property);
|
||
|
entity->setListProperty(list,property);
|
||
|
}
|
||
|
}
|
||
|
|
||
| ... | ... | |
|
break;
|
||
|
}
|
||
|
}
|
||
|
EntityHelper::setListProperty(entity, list, property);
|
||
|
entity->setListProperty(list,property);
|
||
|
}
|
||
|
}
|
||
|
|
||
| ... | ... | |
|
if (var.canConvert<QList<QVariant>>()) {
|
||
|
auto list = EntityInstanceFactory::castQVariantList(var);
|
||
|
list.clear();
|
||
|
EntityHelper::setListProperty(entity, list, property);
|
||
|
entity->setListProperty(list,property);
|
||
|
}
|
||
|
}
|
||
|
|
||
Auch abrufbar als: Unified diff
huray