QObject* MetaObjectMap::create(const QMetaObject& key, QGenericArgument arg1, QGenericArgument arg2) const
{
    if (m_map.contains(key))
    {
        QMetaObject metaObject = m_map[key];
        return metaObject.newInstance(arg1, arg2);
    }

    return NULL;
}
Example #2
0
 PinData::Ptr VertexData::addPinData(const QMetaObject& pinTypeInfo, QString id, Defines::PinDirectionType direction)
 {
   if (pins.contains(id))
   {
     return PinData::Ptr();
   }
   QObject* obj = pinTypeInfo.newInstance(Q_ARG(QString,id),Q_ARG(Defines::PinDirectionType,direction));
   if (obj != 0)
   {
     PinData::Ptr pinPtr = PinData::Ptr(qobject_cast<PinData*>(obj));
     pins.insert(id,pinPtr);
     emit pinDataAdded(pinPtr);
     return pinPtr;
   }
   else
   {
     delete obj;
     return PinData::Ptr();
   }
 }