QModelIndex QtPropertyModel::AppendProperty(const QString &name, QtPropertyData* data, const QModelIndex &parent /* = QModelIndex() */) { if(NULL != data) { QtPropertyData *parentData = itemFromIndexInternal(parent); if(NULL != parentData) { parentData->ChildAdd(name, data); } } return indexFromItem(data); }
void QtPropertyDataDavaVariant::ChildsCreate() { switch(curVariantValue.type) { case DAVA::VariantType::TYPE_KEYED_ARCHIVE: { DAVA::KeyedArchive *archive = curVariantValue.AsKeyedArchive(); DAVA::Map<DAVA::String, DAVA::VariantType*> data = archive->GetArchieveData(); DAVA::Map<DAVA::String, DAVA::VariantType*>::iterator i = data.begin(); for(; i != data.end(); ++i) { ChildAdd(i->first.c_str(), new QtPropertyDataDavaVariant(*(i->second))); } } break; case DAVA::VariantType::TYPE_MATRIX2: break; case DAVA::VariantType::TYPE_MATRIX3: break; case DAVA::VariantType::TYPE_MATRIX4: break; case DAVA::VariantType::TYPE_VECTOR2: { DAVA::Vector2 vec = curVariantValue.AsVector2(); ChildAdd("X", vec.x); ChildAdd("Y", vec.y); } break; case DAVA::VariantType::TYPE_VECTOR3: { DAVA::Vector3 vec = curVariantValue.AsVector3(); ChildAdd("X", vec.x); ChildAdd("Y", vec.y); ChildAdd("Z", vec.z); } break; case DAVA::VariantType::TYPE_VECTOR4: { DAVA::Vector4 vec = curVariantValue.AsVector4(); ChildAdd("X", vec.x); ChildAdd("Y", vec.y); ChildAdd("Z", vec.z); ChildAdd("W", vec.w); } break; case DAVA::VariantType::TYPE_COLOR: { // DAVA::Color color = curVariantValue.AsColor(); // ChildAdd("R", color.r); // ChildAdd("G", color.g); // ChildAdd("B", color.b); // ChildAdd("A", color.a); } break; case DAVA::VariantType::TYPE_AABBOX3: { DAVA::AABBox3 box = curVariantValue.AsAABBox3(); ChildAdd("min", FromVector3(box.min)); ChildAdd("max", FromVector3(box.max)); QtPropertyData* min = ChildGet("min"); min->SetFlags(FLAG_IS_NOT_EDITABLE); min->ChildAdd("X", box.min.x); min->ChildAdd("Y", box.min.y); min->ChildAdd("Z", box.min.z); QtPropertyData* max = ChildGet("max"); max->SetFlags(FLAG_IS_NOT_EDITABLE); max->ChildAdd("X", box.max.x); max->ChildAdd("Y", box.max.y); max->ChildAdd("Z", box.max.z); } break; } }