fix wrong position of segments when loading file. This was, because not the segment property is asked, but the parent and this will not work

additionally support legacy orientation
This commit is contained in:
Martin Marmsoler
2020-09-28 15:42:57 +02:00
parent 6080a7b9c9
commit 48cce42cfe

View File

@@ -1102,11 +1102,21 @@ bool Conductor::pathFromXml(const QDomElement &e) {
// le segment doit avoir une longueur
qreal segment_length;
if (propertyDouble(e, "length", & segment_length))
if (propertyDouble(current_segment, "length", & segment_length))
continue;
bool isHorizontal;
propertyBool(e, "orientation", &isHorizontal);
bool isHorizontal = false;
if (propertyBool(current_segment, "orientation", &isHorizontal) == PropertyFlags::NoValidConversion) {
// legacy
QString orientation;
if (propertyString(current_segment, "orientation", &orientation) == PropertyFlags::Success) {
if (orientation == "horizontal")
isHorizontal = true;
} else {
qDebug() << "PathFromXML failed";
return false;
}
}
if (isHorizontal) {
segments_x << segment_length;