SolidModules
nmpropertyhelper.cpp
Go to the documentation of this file.00001 #include "nmpropertyhelper.h" 00002 00003 NMPropertyHelper::NMPropertyHelper(QObject *master) : mMaster(master) 00004 { 00005 } 00006 00007 NMPropertyHelper::~NMPropertyHelper() 00008 { 00009 } 00010 00011 void NMPropertyHelper::registerProperty(const QString & nmPropertyName, QPair<char*, char*> propSpec) 00012 { 00013 mRegisteredProperties.insert(nmPropertyName, propSpec); 00014 } 00015 00016 void NMPropertyHelper::deserializeProperties(const QVariantMap& propertiesMap) 00017 { 00018 QMapIterator<QString,QVariant> i(propertiesMap); 00019 while (i.hasNext()) { 00020 i.next(); 00021 if (mRegisteredProperties.contains(i.key())) { 00022 QPair<char*,char*> spec = mRegisteredProperties[i.key()]; 00023 mMaster->setProperty(spec.first, i.value()); 00024 //spec.deserializer->deserialize( spec.propertyName, i.value(), mMaster); 00025 // emit signal if one was registered 00026 if ( spec.second != 0 ) 00027 QMetaObject::invokeMethod( mMaster, spec.second ); 00028 } 00029 } 00030 } 00031 00032 NMPropertyDeserializer::~NMPropertyDeserializer() 00033 { 00034 } 00035 00036 void GenericDeserializer::deserialize(const QString & propertyName, const QVariant & value, QObject * recipient) 00037 { 00038 /* 00039 recipient->setProperty(propertyName, value); 00040 QMetaObject::invokeMethod(recipient, signalName); 00041 emit recipient->propertyChanged(propertyName);*/ 00042 }