Revision 75cecd67
Von Christian Ehringfeld vor mehr als 7 Jahren hinzugefügt
src/entityhelper.cpp | ||
---|---|---|
void EntityHelper::setListProperty(const QSharedPointer<Entity> &entity,
|
||
QList<QSharedPointer<Entity>> &list,
|
||
const QMetaProperty &property) {
|
||
QVariant var;
|
||
var.setValue<QList<QSharedPointer<Entity>>>(list);
|
||
entity->setProperty(property.name(),var);
|
||
if(!list.isEmpty()) {
|
||
auto instance = EntityInstanceFactory::createInstance(list.at(0)->getClassname());
|
||
instance->setAsListProperty(entity, list, property);
|
||
}
|
||
property.reset(entity.data());
|
||
}
|
||
|
||
void EntityHelper::addEntityToListProperty(const QSharedPointer<Entity>
|
||
... | ... | |
var) : QList<QSharedPointer<Entity>>());
|
||
if (!list.contains(add)) {
|
||
list.append(add);
|
||
entity->setListProperty(list,property);
|
||
EntityHelper::setListProperty(entity, list, property);
|
||
}
|
||
}
|
||
|
||
... | ... | |
break;
|
||
}
|
||
}
|
||
entity->setListProperty(list,property);
|
||
EntityHelper::setListProperty(entity, list, property);
|
||
}
|
||
}
|
||
|
||
... | ... | |
if (var.canConvert<QList<QVariant>>()) {
|
||
auto list = EntityInstanceFactory::castQVariantList(var);
|
||
list.clear();
|
||
entity->setListProperty(list,property);
|
||
EntityHelper::setListProperty(entity, list, property);
|
||
}
|
||
}
|
||
|
Auch abrufbar als: Unified diff
hmm