Revision 48245e6a
Von Christian Ehringfeld vor mehr als 8 Jahren hinzugefügt
src/entityhelper.cpp | ||
---|---|---|
}
|
||
}
|
||
|
||
void EntityHelper::removeEntityFromListProperty(const QSharedPointer<Entity>
|
||
&entity, QSharedPointer<Entity> remove, const QMetaProperty &property) {
|
||
QVariant var = property.read(entity.data());
|
||
if (!var.isNull() && var.canConvert<QList<QVariant>>()) {
|
||
auto list = EntityInstanceFactory::castQVariantList(var);
|
||
for (int i = 0; i < list.size(); ++i) {
|
||
auto e = list.at(i);
|
||
if(e->getId() == remove->getId()) {
|
||
list.removeAt(i);
|
||
EntityHelper::setListProperty(entity, list, property);
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
void EntityHelper::setProperty(const QSharedPointer<Entity> &entity,
|
||
QSharedPointer<Entity> value,
|
||
const QMetaProperty &property) {
|
Auch abrufbar als: Unified diff
fix