本文整理汇总了C++中QtPropertyData::ChildGet方法的典型用法代码示例。如果您正苦于以下问题:C++ QtPropertyData::ChildGet方法的具体用法?C++ QtPropertyData::ChildGet怎么用?C++ QtPropertyData::ChildGet使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QtPropertyData
的用法示例。
在下文中一共展示了QtPropertyData::ChildGet方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: itemFromIndex
QtPropertyData* QtPropertyModel::itemFromIndex(const QModelIndex & index) const
{
QtPropertyData *ret = NULL;
if(index.isValid() && index.model() == this)
{
QtPropertyData *parent = static_cast<QtPropertyData *>(index.internalPointer());
if(NULL != parent)
{
ret = parent->ChildGet(index.row());
}
}
return ret;
}
示例2: MeSetFromChilds
void QtPropertyDataDavaVariant::MeSetFromChilds(const QString &lastChangedChildKey, QtPropertyData *lastChangedChildData)
{
switch(curVariantValue.type)
{
case DAVA::VariantType::TYPE_KEYED_ARCHIVE:
{
QtPropertyDataDavaVariant *childVariantData = (QtPropertyDataDavaVariant *) lastChangedChildData;
DAVA::KeyedArchive *archive = curVariantValue.AsKeyedArchive();
if(NULL != archive && NULL != childVariantData)
{
archive->SetVariant(lastChangedChildKey.toStdString(), childVariantData->curVariantValue);
}
}
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;
vec.x = ChildGet("X")->GetValue().toFloat();
vec.y = ChildGet("Y")->GetValue().toFloat();
curVariantValue.SetVector2(vec);
}
break;
case DAVA::VariantType::TYPE_VECTOR3:
{
DAVA::Vector3 vec;
vec.x = ChildGet("X")->GetValue().toFloat();
vec.y = ChildGet("Y")->GetValue().toFloat();
vec.z = ChildGet("Z")->GetValue().toFloat();
curVariantValue.SetVector3(vec);
}
break;
case DAVA::VariantType::TYPE_VECTOR4:
{
DAVA::Vector4 vec;
vec.x = ChildGet("X")->GetValue().toFloat();
vec.y = ChildGet("Y")->GetValue().toFloat();
vec.z = ChildGet("Z")->GetValue().toFloat();
vec.w = ChildGet("W")->GetValue().toFloat();
curVariantValue.SetVector4(vec);
}
break;
case DAVA::VariantType::TYPE_COLOR:
{
// DAVA::Color color;
// color.r = ChildGet("R")->GetValue().toFloat();
// color.g = ChildGet("G")->GetValue().toFloat();
// color.b = ChildGet("B")->GetValue().toFloat();
// color.a = ChildGet("A")->GetValue().toFloat();
// curVariantValue.SetColor(color);
}
break;
case DAVA::VariantType::TYPE_AABBOX3:
{
DAVA::AABBox3 box;
QtPropertyData* min = ChildGet("min");
box.min.x = min->ChildGet("X")->GetValue().toFloat();
box.min.y = min->ChildGet("Y")->GetValue().toFloat();
box.min.z = min->ChildGet("Z")->GetValue().toFloat();
QtPropertyData* max = ChildGet("max");
box.max.x = max->ChildGet("X")->GetValue().toFloat();
box.max.y = max->ChildGet("Y")->GetValue().toFloat();
box.max.z = max->ChildGet("Z")->GetValue().toFloat();
curVariantValue.SetAABBox3(box);
}
break;
}
}
示例3: ChildsSetFromMe
void QtPropertyDataDavaVariant::ChildsSetFromMe()
{
switch(curVariantValue.type)
{
case DAVA::VariantType::TYPE_KEYED_ARCHIVE:
{
// No way to change whole archive
// so don't need to re-set childs
}
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();
ChildGet("X")->SetValue(vec.x);
ChildGet("Y")->SetValue(vec.y);
}
break;
case DAVA::VariantType::TYPE_VECTOR3:
{
DAVA::Vector3 vec = curVariantValue.AsVector3();
ChildGet("X")->SetValue(vec.x);
ChildGet("Y")->SetValue(vec.y);
ChildGet("Z")->SetValue(vec.z);
}
break;
case DAVA::VariantType::TYPE_VECTOR4:
{
DAVA::Vector4 vec = curVariantValue.AsVector4();
ChildGet("X")->SetValue(vec.x);
ChildGet("Y")->SetValue(vec.y);
ChildGet("Z")->SetValue(vec.z);
ChildGet("W")->SetValue(vec.w);
}
break;
case DAVA::VariantType::TYPE_COLOR:
{
// DAVA::Color color = curVariantValue.AsColor();
// ChildGet("R")->SetValue(color.r);
// ChildGet("G")->SetValue(color.g);
// ChildGet("B")->SetValue(color.b);
// ChildGet("A")->SetValue(color.a);
}
break;
case DAVA::VariantType::TYPE_AABBOX3:
{
DAVA::AABBox3 box = curVariantValue.AsAABBox3();
QtPropertyData* min = ChildGet("min");
min->SetValue(FromVector3(box.min));
min->ChildGet("X")->SetValue(box.min.x);
min->ChildGet("Y")->SetValue(box.min.y);
min->ChildGet("Z")->SetValue(box.min.z);
QtPropertyData* max = ChildGet("max");
max->SetValue(FromVector3(box.max));
max->ChildGet("X")->SetValue(box.max.x);
max->ChildGet("Y")->SetValue(box.max.y);
max->ChildGet("Z")->SetValue(box.max.z);
}
break;
}
}