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

Method load

src/backend/note/Note.cpp:197–238  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

195}
196
197bool Note::load(XmlStreamReader* reader, bool preview) {
198 Q_D(Note);
199
200 if (!reader->isStartElement() || reader->name() != QLatin1String("note")) {
201 reader->raiseError(i18n("no note element found"));
202 return false;
203 }
204
205 if (!readBasicAttributes(reader))
206 return false;
207
208 QXmlStreamAttributes attribs;
209 QString str;
210
211 while (!reader->atEnd()) {
212 reader->readNext();
213 if (reader->isEndElement() && reader->name() == QLatin1String("note"))
214 break;
215
216 if (!reader->isStartElement())
217 continue;
218
219 if (reader->name() == QLatin1String("comment")) {
220 if (!readCommentElement(reader))
221 return false;
222 } else if (!preview && reader->name() == QLatin1String("background")) {
223 attribs = reader->attributes();
224 READ_QCOLOR(d->backgroundColor);
225 } else if (!preview && reader->name() == QLatin1String("text")) {
226 attribs = reader->attributes();
227 READ_QCOLOR(d->textColor);
228 READ_QFONT(d->textFont);
229 d->text = attribs.value(QStringLiteral("text")).toString();
230 } else { // unknown element
231 reader->raiseUnknownElementWarning();
232 if (!reader->skipToEndElement())
233 return false;
234 }
235 }
236
237 return true;
238}

Callers 15

loadLegacyProjectMethod · 0.45
saveLoadDateTimeMethod · 0.45
loadDoubleFromProjectMethod · 0.45
loadTextFromProjectMethod · 0.45
TestLoadProjectMethod · 0.45
TestLoadProject2Method · 0.45
TestResizeWindowsMethod · 0.45
TestPaddingMethod · 0.45

Calls 7

raiseErrorMethod · 0.80
atEndMethod · 0.80
skipToEndElementMethod · 0.80
nameMethod · 0.45
toStringMethod · 0.45
valueMethod · 0.45

Tested by 15

loadLegacyProjectMethod · 0.36
saveLoadDateTimeMethod · 0.36
loadDoubleFromProjectMethod · 0.36
loadTextFromProjectMethod · 0.36
TestLoadProjectMethod · 0.36
TestLoadProject2Method · 0.36
TestResizeWindowsMethod · 0.36
TestPaddingMethod · 0.36