[qet] [3481] Save and read "is movable" attribute to xml for basic shape & image

[ Thread Index | Date Index | More lists.tuxfamily.org/qet Archives ]


Revision: 3481
Author:   scorpio810
Date:     2014-11-13 12:04:34 +0100 (Thu, 13 Nov 2014)
Log Message:
-----------
Save and read "is movable" attribute to xml for basic shape & image

Modified Paths:
--------------
    trunk/sources/qetgraphicsitem/diagramimageitem.cpp
    trunk/sources/qetgraphicsitem/qetshapeitem.cpp

Modified: trunk/sources/qetgraphicsitem/diagramimageitem.cpp
===================================================================
--- trunk/sources/qetgraphicsitem/diagramimageitem.cpp	2014-11-12 14:44:50 UTC (rev 3480)
+++ trunk/sources/qetgraphicsitem/diagramimageitem.cpp	2014-11-13 11:04:34 UTC (rev 3481)
@@ -198,6 +198,7 @@
 	if (e.tagName() != "image") return (false);
 	QDomNode image_node = e.firstChild();
 	if (!image_node.isText()) return (false);
+	is_movable_ = e.attribute("is_movable", "true").toInt ();
 
 	//load xml image to QByteArray
 	QByteArray array;
@@ -226,6 +227,7 @@
 	result.setAttribute("y", QString("%1").arg(pos().y()));
 	result.setAttribute("rotation", QString("%1").arg(rotation()));
 	result.setAttribute("size", QString("%1").arg(scale()));
+	result.setAttribute("is_movable", bool(is_movable_));
 
 	//write the pixmap in the xml element after he was been transformed to base64
 	QByteArray array;

Modified: trunk/sources/qetgraphicsitem/qetshapeitem.cpp
===================================================================
--- trunk/sources/qetgraphicsitem/qetshapeitem.cpp	2014-11-12 14:44:50 UTC (rev 3480)
+++ trunk/sources/qetgraphicsitem/qetshapeitem.cpp	2014-11-13 11:04:34 UTC (rev 3481)
@@ -204,6 +204,7 @@
 bool QetShapeItem::fromXml(const QDomElement &e) {
 	if (e.tagName() != "shape") return (false);
 
+	is_movable_ = e.attribute("is_movable", "true").toInt ();
 	m_shapeStyle = Qt::PenStyle(e.attribute("style","0").toInt());
 
 	if (e.attribute("type", "0").toInt() != Polyline) {
@@ -235,6 +236,7 @@
 	//write some attribute
 	result.setAttribute("type", QString::number(m_shapeType));
 	result.setAttribute("style", QString::number(m_shapeStyle));
+	result.setAttribute("is_movable", bool(is_movable_));
 
 	if (m_shapeType != Polyline) {
 		result.setAttribute("x1", mapToScene(m_P1).x());


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/