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

Method load

src/backend/worksheet/plots/cartesian/LollipopPlot.cpp:1027–1103  ·  view source on GitHub ↗

Load from XML

Source from the content-addressed store, hash-verified

1025
1026//! Load from XML
1027bool LollipopPlot::load(XmlStreamReader* reader, bool preview) {
1028 Q_D(LollipopPlot);
1029
1030 if (!readBasicAttributes(reader))
1031 return false;
1032
1033 QXmlStreamAttributes attribs;
1034 QString str;
1035 bool firstLineRead = false;
1036 bool firstSymbolRead = false;
1037
1038 while (!reader->atEnd()) {
1039 reader->readNext();
1040 if (reader->isEndElement() && reader->name() == QLatin1String("lollipopPlot"))
1041 break;
1042
1043 if (!reader->isStartElement())
1044 continue;
1045
1046 if (!preview && reader->name() == QLatin1String("comment")) {
1047 if (!readCommentElement(reader))
1048 return false;
1049 } else if (!preview && reader->name() == QLatin1String("general")) {
1050 attribs = reader->attributes();
1051
1052 READ_INT_VALUE("orientation", orientation, LollipopPlot::Orientation);
1053 READ_INT_VALUE_DIRECT("plotRangeIndex", m_cSystemIndex, int);
1054
1055 READ_DOUBLE_VALUE("xMin", xMin);
1056 READ_DOUBLE_VALUE("xMax", xMax);
1057 READ_DOUBLE_VALUE("yMin", yMin);
1058 READ_DOUBLE_VALUE("yMax", yMax);
1059 READ_COLUMN(xColumn);
1060 READ_INT_VALUE("legendVisible", legendVisible, bool);
1061
1062 str = attribs.value(QStringLiteral("visible")).toString();
1063 if (str.isEmpty())
1064 reader->raiseMissingAttributeWarning(QStringLiteral("visible"));
1065 else
1066 d->setVisible(str.toInt());
1067 } else if (reader->name() == QLatin1String("column")) {
1068 attribs = reader->attributes();
1069
1070 str = attribs.value(QStringLiteral("path")).toString();
1071 if (!str.isEmpty())
1072 d->dataColumnPaths << str;
1073 } else if (!preview && reader->name() == QLatin1String("line")) {
1074 if (!firstLineRead) {
1075 auto* line = d->lines.at(0);
1076 line->load(reader, preview);
1077 firstLineRead = true;
1078 } else {
1079 auto* line = d->addLine(KConfigGroup());
1080 line->load(reader, preview);
1081 }
1082 } else if (!preview && reader->name() == QLatin1String("symbol")) {
1083 if (!firstSymbolRead) {
1084 auto* symbol = d->symbols.at(0);

Callers

nothing calls this directly

Calls 14

atEndMethod · 0.80
addSymbolMethod · 0.80
skipToEndElementMethod · 0.80
KConfigGroupClass · 0.70
nameMethod · 0.45
toStringMethod · 0.45
valueMethod · 0.45
isEmptyMethod · 0.45
setVisibleMethod · 0.45
addLineMethod · 0.45

Tested by

no test coverage detected