예제 #1
0
void QtPropertyDataDavaKeyedArcive::ChildCreate(const QString &key, DAVA::VariantType *value)
{
    QtPropertyData *childData = NULL;

    if(value->type == DAVA::VariantType::TYPE_KEYED_ARCHIVE)
    {
        childData = new QtPropertyDataDavaKeyedArcive(value->AsKeyedArchive());
    }
    else
    {
        childData = new QtPropertyDataDavaVariant(*value);
    }

    ChildAdd(key, childData);

    // add optional widget (button) to remove this key
    QPushButton *remButton = new QPushButton(QIcon(":/QtIcons/keyminus.png"), "");
    remButton->setIconSize(QSize(12, 12));
    childData->AddOW(QtPropertyOW(remButton));
    childData->SetOWViewport(GetOWViewport());

    QObject::connect(remButton, SIGNAL(pressed()), this, SLOT(RemKeyedArchiveField()));
}
void QtPropertyDataDavaKeyedArcive::ChildCreate(const QString &key, DAVA::VariantType *value)
{
	QtPropertyData *childData = NULL;

	if(value->type == DAVA::VariantType::TYPE_KEYED_ARCHIVE)
	{
		childData = new QtPropertyDataDavaKeyedArcive(value->AsKeyedArchive());
	}
	else
	{
		childData = new QtPropertyKeyedArchiveMember(curArchive, key.toStdString());

		int presetValueType = EditorConfig::Instance()->GetPropertyValueType(key.toStdString());
		if(presetValueType != DAVA::VariantType::TYPE_NONE)
		{
			if(value->type == presetValueType)
			{
				const DAVA::Vector<DAVA::String>& allowedValues = EditorConfig::Instance()->GetComboPropertyValues(key.toStdString());
				for(size_t i = 0; i < allowedValues.size(); ++i)
				{
					((QtPropertyKeyedArchiveMember *) childData)->AddAllowedValue(DAVA::VariantType((int) i), allowedValues[i].c_str());
				}
			}
		}
	}

	ChildAdd(key, childData);

	// add optional widget (button) to remove this key
	QPushButton *remButton = new QPushButton(QIcon(":/QtIcons/keyminus.png"), "");
	remButton->setIconSize(QSize(12, 12));
	childData->AddOW(QtPropertyOW(remButton));
	childData->SetOWViewport(GetOWViewport());

	QObject::connect(remButton, SIGNAL(pressed()), this, SLOT(RemKeyedArchiveField()));
}