Load from XML
| 624 | |
| 625 | //! Load from XML |
| 626 | bool QQPlot::load(XmlStreamReader* reader, bool preview) { |
| 627 | Q_D(QQPlot); |
| 628 | |
| 629 | if (!readBasicAttributes(reader)) |
| 630 | return false; |
| 631 | |
| 632 | QXmlStreamAttributes attribs; |
| 633 | QString str; |
| 634 | |
| 635 | while (!reader->atEnd()) { |
| 636 | reader->readNext(); |
| 637 | if (reader->isEndElement() && reader->name() == QLatin1String("QQPlot")) |
| 638 | break; |
| 639 | |
| 640 | if (!reader->isStartElement()) |
| 641 | continue; |
| 642 | |
| 643 | if (reader->name() == QLatin1String("comment")) { |
| 644 | if (!readCommentElement(reader)) |
| 645 | return false; |
| 646 | } else if (!preview && reader->name() == QLatin1String("general")) { |
| 647 | attribs = reader->attributes(); |
| 648 | READ_COLUMN(dataColumn); |
| 649 | READ_COLUMN(xReferenceColumn); |
| 650 | READ_COLUMN(yReferenceColumn); |
| 651 | READ_COLUMN(xPercentilesColumn); |
| 652 | READ_COLUMN(yPercentilesColumn); |
| 653 | READ_INT_VALUE("distribution", distribution, nsl_sf_stats_distribution); |
| 654 | READ_INT_VALUE("legendVisible", legendVisible, bool); |
| 655 | |
| 656 | str = attribs.value(QStringLiteral("visible")).toString(); |
| 657 | if (str.isEmpty()) |
| 658 | reader->raiseMissingAttributeWarning(QStringLiteral("visible")); |
| 659 | else |
| 660 | d->setVisible(str.toInt()); |
| 661 | } else if (reader->name() == QLatin1String("column")) { |
| 662 | attribs = reader->attributes(); |
| 663 | bool rc = true; |
| 664 | const auto& name = attribs.value(QStringLiteral("name")); |
| 665 | if (name == QLatin1String("xReference")) |
| 666 | rc = d->xReferenceColumn->load(reader, preview); |
| 667 | else if (name == QLatin1String("yReference")) |
| 668 | rc = d->yReferenceColumn->load(reader, preview); |
| 669 | else if (name == QLatin1String("xPercentiles")) |
| 670 | rc = d->xPercentilesColumn->load(reader, preview); |
| 671 | else if (name == QLatin1String("yPercentiles")) |
| 672 | rc = d->yPercentilesColumn->load(reader, preview); |
| 673 | |
| 674 | if (!rc) |
| 675 | return false; |
| 676 | } else if (reader->name() == QLatin1String("xyCurve")) { |
| 677 | attribs = reader->attributes(); |
| 678 | bool rc = true; |
| 679 | if (attribs.value(QStringLiteral("name")) == QLatin1String("reference")) |
| 680 | rc = d->referenceCurve->load(reader, preview); |
| 681 | else |
| 682 | rc = d->percentilesCurve->load(reader, preview); |
| 683 |
nothing calls this directly
no test coverage detected