84 QJsonObject o = v.toObject();
88 for (QJsonObject::iterator i=o.begin();i!=o.end();++i)
152 o[
"attributes"] =
_form;
157 return QJsonDocument(o);
160 return QJsonDocument(
_form);
182 if (
_baseForm==
"") o[
"base"] = QJsonValue::Null;
189 QJsonObject::iterator i =
_form.begin();
191 while (i !=
_form.end())
193 QString var = i.key();
194 QJsonObject val = i.value().toObject();
196 if (val.contains(
"value"))
212 return QJsonDocument(o);
224 if (
_form.contains(name))
225 printf(
"Warning: form already contains field '%s'... it will be replaced.\n",qUtf8Printable(name));
227 field.
setLabel(name.left(1).toUpper()+name.mid(1),
false);
246 if (
_form.contains(name))
262 if (
_form.contains(name))
264 QJsonObject f =
_form[name].toObject();
265 field.
setIndex( f.value(
"index").toInt() );
266 field.
setLabel( f.value(
"label").toString() );
283 QStringList keys =
_form.keys();
286 for (
int i=0;i<keys.length();i++)
287 { j =
_form[keys[i]].toObject()[
"index"].toInt();
289 _form.remove( keys[i] );
301 return _form.contains(field);
319 QJsonObject v =
_form[var].toObject();
321 if (val.isObject() && v.contains(
"value") && v[
"value"].isObject())
324 QJsonObject vo = val.toObject();
326 if (vo.contains(
"value") && vo[
"value"].isObject())
337 else if (val.isObject())
365 QJsonObject o =
_form[var].toObject();
367 if (o.contains(
"value"))
370 if (o.contains(
"default"))
374 return QJsonValue::Null;
389 QJsonObject v =
_form[var].toObject();
390 QJsonObject op = v[
"options"].toObject();
412 QJsonObject o =
_form[var].toObject()[
"options"].toObject();
414 if (o.contains(option))
418 return QJsonValue::Null;
450 if (useAttributes && diff.contains(
"attributes"))
451 diff = diff[
"attributes"].toObject();
453 QJsonObject::iterator i = diff.begin();
454 while (i != diff.end())
456 if (
_form.contains(i.key()))
458 if (i.value().isNull())
static QJsonObject applyJsonDiff(QJsonObject obj, QJsonObject diff, QString trace="", QString user="server")
Apply a json diff to a json object.
The breakField class adds a space to a form field. Useful for visually separating groups of fields.
setter name
a setter DOCME