remove default parameter, because it leads only to confusion and errors

This commit is contained in:
Martin Marmsoler
2020-10-10 12:02:38 +02:00
parent 9b8c0101be
commit f18e6bd50f
9 changed files with 40 additions and 52 deletions

View File

@@ -121,11 +121,11 @@ QDomElement PartArc::toXml(QDomDocument &xml_document) const {
bool PartArc::fromXml(const QDomElement &qde) {
stylesFromXml(qde);
double x, y, w, h;
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)
double x=0, y=0, w=0, h=0;
if (propertyDouble(qde, "x", &x) == PropertyFlags::NoValidConversion ||
propertyDouble(qde, "y", &y) == PropertyFlags::NoValidConversion ||
propertyDouble(qde, "width", &w) == PropertyFlags::NoValidConversion ||
propertyDouble(qde, "height", &h) == PropertyFlags::NoValidConversion)
return false;
m_rect = QRectF(mapFromScene(x, y), QSizeF(w, h) );

View File

@@ -186,8 +186,8 @@ bool PartDynamicTextField::fromXml(const QDomElement &dom_elmt)
bool frame;
propertyBool(dom_elmt, "frame", &frame);
double text_width;
propertyDouble(dom_elmt, "text_width", &text_width, true, -1);
double text_width=-1;
propertyDouble(dom_elmt, "text_width", &text_width);
setTextWidth(text_width);
QMetaEnum me = DynamicElementTextItem::textFromMetaEnum();

View File

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

View File

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

View File

@@ -87,13 +87,13 @@ bool PartText::fromXml(const QDomElement &xml_element)
propertyString(xml_element, "text", &text);
setPlainText(text);
double x, y, rot;
if (propertyDouble(xml_element, "x", &x, true, 0) == PropertyFlags::NoValidConversion ||
propertyDouble(xml_element, "y", &y, true, 0) == PropertyFlags::NoValidConversion)
double x=0, y=0, rot=0;
if (propertyDouble(xml_element, "x", &x) == PropertyFlags::NoValidConversion ||
propertyDouble(xml_element, "y", &y) == PropertyFlags::NoValidConversion)
return false;
setPos(x, y);
if (propertyDouble(xml_element, "rotation", &rot, true, 0) == PropertyFlags::NoValidConversion)
if (propertyDouble(xml_element, "rotation", &rot) == PropertyFlags::NoValidConversion)
return false;
setRotation(rot);