MCPcopy Create free account
hub / github.com/KDE/labplot / load

Method load

src/backend/worksheet/plots/cartesian/CartesianPlot.cpp:4865–5528  ·  view source on GitHub ↗

Load from XML

Source from the content-addressed store, hash-verified

4863
4864//! Load from XML
4865bool CartesianPlot::load(XmlStreamReader* reader, bool preview) {
4866 Q_D(CartesianPlot);
4867
4868 if (!readBasicAttributes(reader))
4869 return false;
4870
4871 QXmlStreamAttributes attribs;
4872 QString str;
4873 bool titleLabelRead = false;
4874 bool hasCoordinateSystems = false; // new since 2.9.0
4875
4876 while (!reader->atEnd()) {
4877 reader->readNext();
4878 if (reader->isEndElement() && reader->name() == QLatin1String("cartesianPlot"))
4879 break;
4880
4881 if (!reader->isStartElement())
4882 continue;
4883
4884 if (reader->name() == QLatin1String("comment")) {
4885 if (!readCommentElement(reader))
4886 return false;
4887 } else if (!preview && reader->name() == QLatin1String("theme")) {
4888 attribs = reader->attributes();
4889 d->theme = attribs.value(QStringLiteral("name")).toString();
4890 } else if (!preview && reader->name() == QLatin1String("cursor")) {
4891 d->cursorLine->load(reader, preview);
4892 } else if (!preview && reader->name() == QLatin1String("geometry")) {
4893 attribs = reader->attributes();
4894
4895 str = attribs.value(QStringLiteral("x")).toString();
4896 if (str.isEmpty())
4897 reader->raiseMissingAttributeWarning(QStringLiteral("x"));
4898 else
4899 d->rect.setX(str.toDouble());
4900
4901 str = attribs.value(QStringLiteral("y")).toString();
4902 if (str.isEmpty())
4903 reader->raiseMissingAttributeWarning(QStringLiteral("y"));
4904 else
4905 d->rect.setY(str.toDouble());
4906
4907 str = attribs.value(QStringLiteral("width")).toString();
4908 if (str.isEmpty())
4909 reader->raiseMissingAttributeWarning(QStringLiteral("width"));
4910 else
4911 d->rect.setWidth(str.toDouble());
4912
4913 str = attribs.value(QStringLiteral("height")).toString();
4914 if (str.isEmpty())
4915 reader->raiseMissingAttributeWarning(QStringLiteral("height"));
4916 else
4917 d->rect.setHeight(str.toDouble());
4918
4919 str = attribs.value(QStringLiteral("visible")).toString();
4920 if (str.isEmpty())
4921 reader->raiseMissingAttributeWarning(QStringLiteral("visible"));
4922 else

Callers

nothing calls this directly

Calls 15

setColorPaletteMethod · 0.95
RangeBreakStyleEnum · 0.85
atEndMethod · 0.80
setXMethod · 0.80
setYMethod · 0.80
setHeightMethod · 0.80
setAutoScaleMethod · 0.80
rangeMethod · 0.80
setIsLoadingMethod · 0.80
skipToEndElementMethod · 0.80

Tested by

no test coverage detected