Fix issues

This commit is contained in:
Martin Marmsoler
2020-10-07 08:05:01 +02:00
parent b958848194
commit a1cf3711a1
11 changed files with 55 additions and 57 deletions

View File

@@ -122,10 +122,10 @@ bool PartArc::fromXml(const QDomElement &qde) {
stylesFromXml(qde);
double x, y, w, h;
if (propertyDouble(qde, "x", &x, 0) == PropertyFlags::NoValidConversion ||
propertyDouble(qde, "y", &y, 0) == PropertyFlags::NoValidConversion ||
propertyDouble(qde, "width", &w, 0) == PropertyFlags::NoValidConversion ||
propertyDouble(qde, "height", &h, 0) == PropertyFlags::NoValidConversion)
if (propertyDouble(qde, "x", &x, true, 0) == PropertyFlags::NoValidConversion ||
propertyDouble(qde, "y", &y, true, 0) == PropertyFlags::NoValidConversion ||
propertyDouble(qde, "width", &w, true, 0) == PropertyFlags::NoValidConversion ||
propertyDouble(qde, "height", &h, true, 0) == PropertyFlags::NoValidConversion)
return false;
m_rect = QRectF(mapFromScene(x, y), QSizeF(w, h) );

View File

@@ -112,19 +112,19 @@ bool PartEllipse::fromXml(const QDomElement &qde)
if (qde.tagName() == "ellipse")
{
if (propertyDouble(qde, "width", &width, 0) == PropertyFlags::NoValidConversion ||
propertyDouble(qde, "height", &height, 0) == PropertyFlags::NoValidConversion)
if (propertyDouble(qde, "width", &width, true, 0) == PropertyFlags::NoValidConversion ||
propertyDouble(qde, "height", &height, true, 0) == PropertyFlags::NoValidConversion)
return false;
}
else {
if (propertyDouble(qde, "diameter", &width, 0) == PropertyFlags::NoValidConversion)
if (propertyDouble(qde, "diameter", &width, true, 0) == PropertyFlags::NoValidConversion)
return false;
height = width;
}
if (propertyDouble(qde, "x", &x, 0) == PropertyFlags::NoValidConversion ||
propertyDouble(qde, "y", &y, 0) == PropertyFlags::NoValidConversion)
if (propertyDouble(qde, "x", &x, true, 0) == PropertyFlags::NoValidConversion ||
propertyDouble(qde, "y", &y, true, 0) == PropertyFlags::NoValidConversion)
return false;
m_rect = QRectF(mapFromScene(x, y), QSizeF(width, height));

View File

@@ -151,9 +151,6 @@ bool PartLine::fromXml(const QDomElement &qde) {
first_end = Qet::endTypeFromString(s);
first_length = 1.5;
second_length = 1.5;
if (propertyDouble(qde, "length1", &first_length) == PropertyFlags::NoValidConversion ||
propertyDouble(qde, "length2", &second_length) == PropertyFlags::NoValidConversion)
return false;

View File

@@ -118,10 +118,10 @@ class PartLine : public CustomElementGraphicPart
/*****************/
Qet::EndType first_end;
qreal first_length;
qreal first_length{1.5};
Qet::EndType second_end;
qreal second_length;
qreal second_length{1.5};
QList<QPointF> saved_points_;
QLineF m_line;
int m_vector_index = -1;

View File

@@ -117,22 +117,22 @@ bool PartRectangle::fromXml(const QDomElement &qde)
stylesFromXml(qde);
double x, y, w, h, rx, ry;
if (propertyDouble(qde, "x", &x, 0) == PropertyFlags::NoValidConversion ||
propertyDouble(qde, "y", &y, 0) == PropertyFlags::NoValidConversion)
if (propertyDouble(qde, "x", &x, true, 0) == PropertyFlags::NoValidConversion ||
propertyDouble(qde, "y", &y, true, 0) == PropertyFlags::NoValidConversion)
return false;
setPos(mapFromScene(x, y));
if (propertyDouble(qde, "width", &w, 0) == PropertyFlags::NoValidConversion ||
propertyDouble(qde, "width", &h, 0) == PropertyFlags::NoValidConversion)
if (propertyDouble(qde, "width", &w, true, 0) == PropertyFlags::NoValidConversion ||
propertyDouble(qde, "width", &h, true, 0) == PropertyFlags::NoValidConversion)
return false;
QRectF rect(QPointF(0,0), QSizeF(w, h));
QRectF rect(QPointF(x,y), QSizeF(w, h));
setRect(rect.normalized());
if (propertyDouble(qde, "rx", &rx, 0) == PropertyFlags::NoValidConversion ||
propertyDouble(qde, "ry", &ry, 0) == PropertyFlags::NoValidConversion)
if (propertyDouble(qde, "rx", &rx, true, 0) == PropertyFlags::NoValidConversion ||
propertyDouble(qde, "ry", &ry, true, 0) == PropertyFlags::NoValidConversion)
return false;
setXRadius(rx);

View File

@@ -49,8 +49,7 @@ bool PartTerminal::fromXml(const QDomElement &xml_elmt) {
// update part and add uuid, which is used in the new version to connect terminals together
// if the attribute not exists, means, the element is created with an older version of qet. So use the legacy approach
// to identify terminals
if (propertyUuid(xml_elmt, "uuid", &uuid) == PropertyFlags::Success)
d->m_uuid = QUuid(uuid);
propertyUuid(xml_elmt, "uuid", &d->m_uuid);
if (!d->fromXml(xml_elmt))
return false;

View File

@@ -78,22 +78,22 @@ bool PartText::fromXml(const QDomElement &xml_element)
return false;
}
QString color;
QColor color;
QString text;
propertyString(xml_element, "color", &color, "#000000");
setDefaultTextColor(QColor(color));
propertyColor(xml_element, "color", &color);
setDefaultTextColor(color);
propertyString(xml_element, "text", &text);
setPlainText(text);
double x, y, rot;
if (propertyDouble(xml_element, "x", &x, 0) == PropertyFlags::NoValidConversion ||
propertyDouble(xml_element, "y", &y, 0) == PropertyFlags::NoValidConversion)
if (propertyDouble(xml_element, "x", &x, true, 0) == PropertyFlags::NoValidConversion ||
propertyDouble(xml_element, "y", &y, true, 0) == PropertyFlags::NoValidConversion)
return false;
setPos(x, y);
if (propertyDouble(xml_element, "rotation", &rot, 0) == PropertyFlags::NoValidConversion)
if (propertyDouble(xml_element, "rotation", &rot, true, 0) == PropertyFlags::NoValidConversion)
return false;
setRotation(rot);