Change some int to qreal

Made this change to be more compliant with svg
This commit is contained in:
joshua
2025-06-08 21:40:32 +02:00
parent 95e401a266
commit d699faf501
7 changed files with 60 additions and 60 deletions

View File

@@ -118,12 +118,12 @@ QDomElement TerminalStripLayoutPatternXml::toXml(const QSharedPointer<TerminalSt
terminals_xml.appendChild(terminals_text_xml);
auto bridge_xml = document.createElement(QStringLiteral("bridges"));
QETSVG::rToAttribute(static_cast<qreal>(pattern->m_bridge_point_d)/2, bridge_xml);
QETSVG::pointsToAttribute(QVector<QPointF>{QPointF{0, static_cast<qreal> (pattern->m_bridge_point_y_offset.at(0))},
QPointF{0, static_cast<qreal> (pattern->m_bridge_point_y_offset.at(1))},
QPointF{0, static_cast<qreal> (pattern->m_bridge_point_y_offset.at(2))},
QPointF{0, static_cast<qreal> (pattern->m_bridge_point_y_offset.at(3))}},
bridge_xml);
QETSVG::rToAttribute(pattern->m_bridge_point_d/2, bridge_xml);
QVector<QPointF> points_vector;
for (const auto &y : pattern->m_bridge_point_y_offset) {
points_vector.append(QPointF{0,y});
}
QETSVG::pointsToAttribute(points_vector, bridge_xml);
terminals_xml.appendChild(bridge_xml);
pattern_xml.appendChild(terminals_xml);
@@ -181,10 +181,10 @@ void TerminalStripLayoutPatternXml::fromXml(QSharedPointer<TerminalStripLayoutPa
layout->m_bridge_point_d = QETSVG::rFromAttribute(bridge_xml, 2.5)*2;
if (const auto points = QETSVG::pointsFromAttribute(bridge_xml);
points.size() == 4) {
layout->m_bridge_point_y_offset[0]= static_cast<int>(points[0].y());
layout->m_bridge_point_y_offset[1]= static_cast<int>(points[1].y());
layout->m_bridge_point_y_offset[2]= static_cast<int>(points[2].y());
layout->m_bridge_point_y_offset[3]= static_cast<int>(points[3].y());
layout->m_bridge_point_y_offset[0]= points[0].y();
layout->m_bridge_point_y_offset[1]= points[1].y();
layout->m_bridge_point_y_offset[2]= points[2].y();
layout->m_bridge_point_y_offset[3]= points[3].y();
}
}
}

View File

@@ -25,8 +25,8 @@ class TerminalStripLayoutPattern;
/**
* @brief The TerminalStripLayoutPatternXml class
* A class used to save/restor a @class TerminalStripLayoutPattern to
* xml
* A class with static function used to save/restor a
* @class TerminalStripLayoutPattern to xml
*/
class TerminalStripLayoutPatternXml
{