void EnumPropItem::slotEnumChanged(const QString &text) { if ( nameByType(object()->property(propertyName().toLatin1()).toInt())!=text){ beginChangeValue(); setPropertyValue(typeByName(text)); setValueToObject(propertyName(),typeByName(text)); endChangeValue(); } }
void RemoveDataCommand::undoReplayed() { for(auto it = m_Guids.rbegin(); it != m_Guids.rend(); ++it) { reflection::Type* pType = typeByName(m_Types[*it]); o_assert(pType AND pType->isDefaultInstanciable()); void* pData = pType->newInstance(); auto foundRef = m_ComponentReferenceExpressions.find(*it); if(foundRef != m_ComponentReferenceExpressions.end()) { // Component reflection::Expression* pExpression = phantom::expressionByName("("+foundRef->second+")=static_cast<"+pType->getQualifiedDecoratedName()+"*>(0x"+lexical_cast<string>(pData)+")"); o_assert(pExpression); pExpression->eval(); o_dynamic_delete pExpression; } else { serialization::Node* pNode = m_pDataBase->getNode(m_Nodes[*it]); o_assert(pNode); m_pDataBase->addData(data(pData, pType), pNode); } } }
void EnumPropItem::setModelData(QWidget *propertyEditor, QAbstractItemModel *model, const QModelIndex &index) { setValueToObject(propertyName(),typeByName(qobject_cast<ComboBoxEditor*>(propertyEditor)->text())); model->setData(index,object()->property(propertyName().toLatin1())); }