mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-01-06 13:40:52 +01:00
element-editor: limit decimal places for sizes and positions to two, when saving file
This commit is contained in:
@@ -115,15 +115,22 @@ const QDomElement PartLine::toXml(QDomDocument &xml_document) const
|
||||
QPointF p1(sceneP1());
|
||||
QPointF p2(sceneP2());
|
||||
|
||||
p1.setX((qRound(p1.x() * 100.0)) / 100.0);
|
||||
p1.setY((qRound(p1.y() * 100.0)) / 100.0);
|
||||
p2.setX((qRound(p2.x() * 100.0)) / 100.0);
|
||||
p2.setY((qRound(p2.y() * 100.0)) / 100.0);
|
||||
qreal firstLength = ((qRound(first_length * 100.0)) / 100.0);
|
||||
qreal secondLength = ((qRound(second_length * 100.0)) / 100.0);
|
||||
|
||||
QDomElement xml_element = xml_document.createElement("line");
|
||||
xml_element.setAttribute("x1", QString("%1").arg(p1.x()));
|
||||
xml_element.setAttribute("y1", QString("%1").arg(p1.y()));
|
||||
xml_element.setAttribute("x2", QString("%1").arg(p2.x()));
|
||||
xml_element.setAttribute("y2", QString("%1").arg(p2.y()));
|
||||
xml_element.setAttribute("end1", Qet::endTypeToString(first_end));
|
||||
xml_element.setAttribute("length1", QString("%1").arg(first_length));
|
||||
xml_element.setAttribute("length1", QString("%1").arg(firstLength));
|
||||
xml_element.setAttribute("end2", Qet::endTypeToString(second_end));
|
||||
xml_element.setAttribute("length2", QString("%1").arg(second_length));
|
||||
xml_element.setAttribute("length2", QString("%1").arg(secondLength));
|
||||
|
||||
stylesToXml(xml_element);
|
||||
return(xml_element);
|
||||
|
||||
Reference in New Issue
Block a user