Load from XML
| 590 | |
| 591 | //! Load from XML |
| 592 | bool DatapickerCurve::load(XmlStreamReader* reader, bool preview) { |
| 593 | Q_D(DatapickerCurve); |
| 594 | |
| 595 | if (!readBasicAttributes(reader)) |
| 596 | return false; |
| 597 | |
| 598 | QXmlStreamAttributes attribs; |
| 599 | QString str; |
| 600 | |
| 601 | while (!reader->atEnd()) { |
| 602 | reader->readNext(); |
| 603 | if (reader->isEndElement() && reader->name() == QLatin1String("datapickerCurve")) |
| 604 | break; |
| 605 | |
| 606 | if (!reader->isStartElement()) |
| 607 | continue; |
| 608 | |
| 609 | if (reader->name() == QLatin1String("comment")) { |
| 610 | if (!readCommentElement(reader)) |
| 611 | return false; |
| 612 | } else if (!preview && reader->name() == QLatin1String("general")) { |
| 613 | attribs = reader->attributes(); |
| 614 | |
| 615 | READ_INT_VALUE("visible", pointVisibility, bool); |
| 616 | READ_INT_VALUE("curveErrorType_X", curveErrorTypes.x, ErrorType); |
| 617 | READ_INT_VALUE("curveErrorType_Y", curveErrorTypes.y, ErrorType); |
| 618 | |
| 619 | READ_COLUMN_NAME(posXColumn); |
| 620 | READ_COLUMN_NAME(posYColumn); |
| 621 | READ_COLUMN_NAME(posZColumn); |
| 622 | READ_COLUMN_NAME(plusDeltaXColumn); |
| 623 | READ_COLUMN_NAME(minusDeltaXColumn); |
| 624 | READ_COLUMN_NAME(plusDeltaYColumn); |
| 625 | READ_COLUMN_NAME(minusDeltaYColumn); |
| 626 | } else if (!preview && reader->name() == QLatin1String("symbolProperties")) { |
| 627 | // old serialization that was used before the switch to Symbol::load(). |
| 628 | // in the old serialization the symbol properties and "point visibility" where saved |
| 629 | // under "symbolProperties". |
| 630 | attribs = reader->attributes(); |
| 631 | |
| 632 | str = attribs.value(QStringLiteral("pointRotationAngle")).toString(); |
| 633 | if (str.isEmpty()) |
| 634 | reader->raiseMissingAttributeWarning(QStringLiteral("pointRotationAngle")); |
| 635 | else |
| 636 | d->symbol->setRotationAngle(str.toDouble()); |
| 637 | |
| 638 | str = attribs.value(QStringLiteral("pointOpacity")).toString(); |
| 639 | if (str.isEmpty()) |
| 640 | reader->raiseMissingAttributeWarning(QStringLiteral("pointOpacity")); |
| 641 | else |
| 642 | d->symbol->setOpacity(str.toDouble()); |
| 643 | |
| 644 | str = attribs.value(QStringLiteral("pointSize")).toString(); |
| 645 | if (str.isEmpty()) |
| 646 | reader->raiseMissingAttributeWarning(QStringLiteral("pointSize")); |
| 647 | else |
| 648 | d->symbol->setSize(str.toDouble()); |
| 649 |
nothing calls this directly
no test coverage detected