Load from XML
| 1437 | |
| 1438 | //! Load from XML |
| 1439 | bool BarPlot::load(XmlStreamReader* reader, bool preview) { |
| 1440 | Q_D(BarPlot); |
| 1441 | |
| 1442 | if (!readBasicAttributes(reader)) |
| 1443 | return false; |
| 1444 | |
| 1445 | QXmlStreamAttributes attribs; |
| 1446 | QString str; |
| 1447 | bool firstBackgroundRead = false; |
| 1448 | bool firstBorderLineRead = false; |
| 1449 | bool firstErrorBarRead = false; |
| 1450 | |
| 1451 | while (!reader->atEnd()) { |
| 1452 | reader->readNext(); |
| 1453 | if (reader->isEndElement() && reader->name() == QLatin1String("barPlot")) |
| 1454 | break; |
| 1455 | |
| 1456 | if (!reader->isStartElement()) |
| 1457 | continue; |
| 1458 | |
| 1459 | if (!preview && reader->name() == QLatin1String("comment")) { |
| 1460 | if (!readCommentElement(reader)) |
| 1461 | return false; |
| 1462 | } else if (!preview && reader->name() == QLatin1String("general")) { |
| 1463 | attribs = reader->attributes(); |
| 1464 | |
| 1465 | READ_INT_VALUE("type", type, BarPlot::Type); |
| 1466 | READ_INT_VALUE("orientation", orientation, BarPlot::Orientation); |
| 1467 | READ_DOUBLE_VALUE("widthFactor", widthFactor); |
| 1468 | READ_INT_VALUE_DIRECT("plotRangeIndex", m_cSystemIndex, int); |
| 1469 | |
| 1470 | READ_DOUBLE_VALUE("xMin", xMin); |
| 1471 | READ_DOUBLE_VALUE("xMax", xMax); |
| 1472 | READ_DOUBLE_VALUE("yMin", yMin); |
| 1473 | READ_DOUBLE_VALUE("yMax", yMax); |
| 1474 | READ_COLUMN(xColumn); |
| 1475 | READ_INT_VALUE("legendVisible", legendVisible, bool); |
| 1476 | |
| 1477 | str = attribs.value(QStringLiteral("visible")).toString(); |
| 1478 | if (str.isEmpty()) |
| 1479 | reader->raiseMissingAttributeWarning(QStringLiteral("visible")); |
| 1480 | else |
| 1481 | d->setVisible(str.toInt()); |
| 1482 | } else if (reader->name() == QLatin1String("column")) { |
| 1483 | attribs = reader->attributes(); |
| 1484 | |
| 1485 | str = attribs.value(QStringLiteral("path")).toString(); |
| 1486 | if (!str.isEmpty()) |
| 1487 | d->dataColumnPaths << str; |
| 1488 | // READ_COLUMN(dataColumn); |
| 1489 | } else if (!preview && reader->name() == QLatin1String("filling")) { |
| 1490 | if (!firstBackgroundRead) { |
| 1491 | auto* background = d->backgrounds.at(0); |
| 1492 | background->load(reader, preview); |
| 1493 | firstBackgroundRead = true; |
| 1494 | } else { |
| 1495 | auto* background = d->addBackground(KConfigGroup()); |
| 1496 | background->load(reader, preview); |
nothing calls this directly
no test coverage detected