当前位置: 首页>>代码示例>>C++>>正文


C++ QtPropertyData::SetFlags方法代码示例

本文整理汇总了C++中QtPropertyData::SetFlags方法的典型用法代码示例。如果您正苦于以下问题:C++ QtPropertyData::SetFlags方法的具体用法?C++ QtPropertyData::SetFlags怎么用?C++ QtPropertyData::SetFlags使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QtPropertyData的用法示例。


在下文中一共展示了QtPropertyData::SetFlags方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: AddMember

void QtPropertyDataIntrospection::AddMember(const DAVA::IntrospectionMember *member, int hasAnyFlags, int hasNotAnyFlags)
{
	void *memberObject = member->Data(object);
	const DAVA::MetaInfo *memberMetaInfo = member->Type();
	const DAVA::IntrospectionInfo *memberIntrospection = memberMetaInfo->GetIntrospection(memberObject);
	bool isKeyedArchive = false;

	// keyed archive
	if(NULL != memberIntrospection && (memberIntrospection->Type() == DAVA::MetaInfo::Instance<DAVA::KeyedArchive>()))
	{
		QtPropertyDataDavaKeyedArcive *childData = new QtPropertyDataDavaKeyedArcive((DAVA::KeyedArchive *) memberObject);
		ChildAdd(member->Name(), childData);
	}
	// introspection
	else if(NULL != memberObject && NULL != memberIntrospection)
    {
		QtPropertyDataIntrospection *childData = new QtPropertyDataIntrospection(memberObject, memberIntrospection, hasAnyFlags, hasNotAnyFlags);
		ChildAdd(member->Name(), childData);
    }
	// any other value
    else
    {
		// pointer
        if(memberMetaInfo->IsPointer())
        {
			QString s;
            QtPropertyData* childData = new QtPropertyData(s.sprintf("[%p] Pointer", memberObject));
            childData->SetFlags(childData->GetFlags() | FLAG_IS_DISABLED);
            ChildAdd(member->Name(), childData);
        }
		// other value
        else
        {
			// collection
            if(member->Collection() && !isKeyedArchive)
            {
                QtPropertyDataIntroCollection *childCollection = new QtPropertyDataIntroCollection(memberObject, member->Collection(), hasAnyFlags, hasNotAnyFlags);
                ChildAdd(member->Name(), childCollection);
            }
			// variant
            else
            {
                QtPropertyDataDavaVariant *childData = new QtPropertyDataDavaVariant(member->Value(object));
                if(member->Flags() & DAVA::INTROSPECTION_EDITOR_READONLY)
                {
                    childData->SetFlags(childData->GetFlags() | FLAG_IS_NOT_EDITABLE);
                }
                
                ChildAdd(member->Name(), childData);
                childVariantMembers.insert(childData, member);
            }
        }
    }
}
开发者ID:boyjimeking,项目名称:dava.framework,代码行数:54,代码来源:QtPropertyDataIntrospection.cpp

示例2: if

QtPropertyData * QtPropertyDataIntrospection::CreateMemberData(void *_object, const DAVA::InspMember *member, int hasAllFlags)
{
	void *memberObject = member->Data(_object);
	const DAVA::MetaInfo *memberMetaInfo = member->Type();
	const DAVA::InspInfo *memberIntrospection = memberMetaInfo->GetIntrospection(memberObject);
	bool isKeyedArchive = false;

	QtPropertyData * retData = NULL;
	// keyed archive
	if(NULL != memberIntrospection && (memberIntrospection->Type() == DAVA::MetaInfo::Instance<DAVA::KeyedArchive>()))
	{
		retData = new QtPropertyDataDavaKeyedArcive((DAVA::KeyedArchive *) memberObject);
	}
	// introspection
	else if(NULL != memberObject && NULL != memberIntrospection)
    {
		retData = new QtPropertyDataIntrospection(memberObject, memberIntrospection, hasAllFlags);
    }
	// any other value
    else
    {
		// pointer
        if(memberMetaInfo->IsPointer())
        {
			QString s;
            retData = new QtPropertyData(s.sprintf("[%p] Pointer", memberObject));
            retData->SetFlags(retData->GetFlags() | FLAG_IS_DISABLED);
        }
		// other value
        else
        {
			// collection
            if(member->Collection() && !isKeyedArchive)
            {
                retData = new QtPropertyDataInspColl(memberObject, member->Collection(), hasAllFlags);
            }
			// variant
            else
            {
                QtPropertyDataInspMember *childData = new QtPropertyDataInspMember(_object, member);
                if(!(member->Flags() & DAVA::I_EDIT))
                {
                    childData->SetFlags(childData->GetFlags() | FLAG_IS_NOT_EDITABLE);
                }
				else
				{
					// check if description has some predefines enum values
					const DAVA::InspDesc &desc = member->Desc();

					if(NULL != desc.enumMap)
					{
						for(size_t i = 0; i < desc.enumMap->GetCount(); ++i)
						{
							int v;
							if(desc.enumMap->GetValue(i, v))
							{
								childData->AddAllowedValue(DAVA::VariantType(v), desc.enumMap->ToString(v));
							}
						}
					}
				}
                
                retData = childData;
            }
        }
    }
	return retData;
}
开发者ID:droidenko,项目名称:dava.framework,代码行数:68,代码来源:QtPropertyDataIntrospection.cpp

示例3: ChildsCreate

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;
	}
}
开发者ID:abaradulkin,项目名称:dava.framework,代码行数:77,代码来源:QtPropertyDataDavaVariant.cpp


注:本文中的QtPropertyData::SetFlags方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。