void XmlFontSerializator::save(const QVariant &value, QString name)
{

    QFont font = value.value<QFont>();
    QDomElement _node = doc()->createElement(name);
    _node.setAttribute("Type","QFont");
    _node.setAttribute("family",font.family());
    _node.setAttribute("pointSize",font.pointSize());
    saveBool(_node,"bold",font.bold());
    saveBool(_node,"italic",font.italic());
    saveBool(_node,"underline",font.underline());

    node()->appendChild(_node);
}
void XmlFontSerializator::save(const QVariant &value, QString name)
{
    QFont font = value.value<QFont>();
    QDomElement _node = doc()->createElement(name);
    _node.setAttribute("Type","QFont");
    _node.setAttribute("family",font.family());
    _node.setAttribute("pointSize",font.pointSize());
#if QT_VERSION>0x040800
    _node.setAttribute("stylename",font.styleName());
#endif
    _node.setAttribute("weight",font.weight());
    //saveBool(_node,"bold",font.bold());
    saveBool(_node,"italic",font.italic());
    saveBool(_node,"underline",font.underline());
    node()->appendChild(_node);
}
Ejemplo n.º 3
0
Magic3D::XMLElement* Magic3D::ObjectInstance::save(XMLElement* root)
{
    if (root)
    {
        saveString(root, M3D_OBJECT_INSTANCE_NAME, instance ? instance->getName() : M3D_XML_NULL);
        saveBool(root,   M3D_OBJECT_INSTANCE_SPAWN, spawnOnLoad);
        Object::save(root);
    }
    return root;
}
Ejemplo n.º 4
0
Magic3D::XMLElement* Magic3D::Object::save(XMLElement* root)
{
    if (root)
    {
        saveString(root, M3D_OBJECT_XML_NAME,        getName());
        saveString(root, M3D_OBJECT_XML_SCRIPT,      getScript());
        saveString(root, M3D_OBJECT_XML_PARENT,      getParent() ? getParent()->getName().c_str() : M3D_XML_NULL);
        saveString(root, M3D_OBJECT_XML_PARENT_BONE, getParentBone() ? getParentBone()->getName().c_str() : M3D_XML_NULL);

        saveBool(root,   M3D_OBJECT_XML_PARENT_POSITION, isParentPosition());
        saveBool(root,   M3D_OBJECT_XML_PARENT_ROTATION, isParentRotation());
        saveBool(root,   M3D_OBJECT_XML_PARENT_SCALE, isParentScale());

        saveInt(root,    M3D_OBJECT_XML_RENDER,    getRender());
        saveInt(root,    M3D_OBJECT_XML_TYPE,      getType());
        saveInt(root,    M3D_OBJECT_XML_FLAG,      getFlag());
        saveInt(root,    M3D_OBJECT_XML_BILLBOARD, getBillboard());

        saveBool(root,   M3D_OBJECT_XML_ENABLED,  isEnabled());
        saveBool(root,   M3D_OBJECT_XML_VISIBLE,  isVisible());
        saveBool(root,   M3D_OBJECT_XML_ZORDER,   isZOrder());
        saveBool(root,   M3D_OBJECT_XML_PICK,     isPickable());

        saveVector3(root, M3D_OBJECT_XML_POSITION, getPosition());
        saveVector4(root, M3D_OBJECT_XML_ROTATION, Vector4(getRotation()));
        saveVector3(root, M3D_OBJECT_XML_SCALE,    getScale());

        saveBool(root,    M3D_OBJECT_XML_SCRIPTED,  isScripted());

        std::vector<Mesh*>::const_iterator it_m = meshes.begin();
        while (it_m != meshes.end())
        {
            Mesh* mesh = *it_m++;

            XMLElement* meshtXML = root->GetDocument()->NewElement( M3D_MESH_XML );
            meshtXML->SetAttribute("materials", (int)mesh->getMaterials()->size());
            root->LinkEndChild( meshtXML );

            mesh->save(meshtXML);
        }

        PhysicsObject::save(root);
    }
    return root;
}