Ejemplo n.º 1
0
bool KivioLineStyle::loadXML( const QDomElement &e )
{
    m_color     = XmlReadColor( e, "color",     QColor(0,0,0) );
    m_width     = XmlReadFloat( e, "width",     1.0f );
    m_capStyle  = XmlReadInt(   e, "capStyle",  Qt::RoundCap );
    m_joinStyle = XmlReadInt(   e, "joinStyle", Qt::RoundJoin );
    m_style     = XmlReadInt(   e, "pattern",   Qt::SolidLine );
    return true;
}
Ejemplo n.º 2
0
/**
 * Loads a shape of type textbox.
 *
 * @param e The element to load from.
 * @returns A newly allocated KivioShape, or NULL on error.
 */
KivioShape *KivioShape::loadShapeTextBox( const QDomElement &e )
{
    KivioShape *pShape = NULL;
    QDomNode node;
    QString nodeName;
    KivioTextStyle ts;
    QString name;


    // Create the new shape to load into
    pShape = new KivioShape();

    // Load the type and name
    pShape->m_shapeData.setShapeType(KivioShapeData::kstTextBox);
    pShape->m_shapeData.setName( XmlReadString( e, "name", "" ) );
    pShape->m_shapeData.setTextColor(XmlReadColor(e,"color",QColor(0,0,0)));

    pShape->m_shapeData.m_position.set( 
       XmlReadFloat( e, "x", 0.0f ), XmlReadFloat( e, "y", 0.0f ) );
    pShape->m_shapeData.m_dimensions.set( 
       XmlReadFloat( e, "w", 72.0f ), XmlReadFloat( e, "h", 72.0f ) );

    // Now look for the KivioTextStyle
    node = e.firstChild();
    while( !node.isNull() )
    {
       nodeName = node.nodeName();
       if( nodeName == "KivioTextStyle" )
       {
	  ts.loadXML( node.toElement() );
	  pShape->m_shapeData.setTextStyle( &ts );
       }

       node = node.nextSibling();
    }
//    QString text = XmlReadString( e, "text", "" );
//    pShape->m_shapeData.setText( text );


    return pShape;
}