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

Method loadJson

src/backend/datasources/filters/QJsonModel.cpp:193–209  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

191}
192
193bool QJsonModel::loadJson(const QByteArray& json) {
194 QJsonParseError jsonError;
195
196 const QJsonDocument& doc = QJsonDocument::fromJson(json, &jsonError);
197 if (jsonError.error == QJsonParseError::NoError) {
198 const bool rc = loadJson(doc);
199 if (!rc)
200 Q_EMIT error(i18n("Failed to load the JSON file. Empty JSON document."));
201 else
202 Q_EMIT error(QString());
203
204 return rc;
205 } else {
206 Q_EMIT error(i18n("Failed to load JSON document. Error: %1.", jsonError.errorString()));
207 return false;
208 }
209}
210
211bool QJsonModel::loadJson(const QJsonDocument& jdoc) {
212 PERFTRACE(QStringLiteral("load json document into the model"));

Callers 2

loadDocumentMethod · 0.80
prepareDocumentToReadMethod · 0.80

Calls 4

isNullMethod · 0.80
appendChildMethod · 0.80
QStringClass · 0.70
setTypeMethod · 0.45

Tested by

no test coverage detected