11using namespace Qt::StringLiterals;
13#ifdef QFORMINTERNAL_NAMESPACE
14using namespace QFormInternal;
18
19
24 delete m_layoutDefault;
25 delete m_layoutFunction;
26 delete m_customWidgets;
31 delete m_designerdata;
33 delete m_buttonGroups;
36void DomUI::read(QXmlStreamReader &reader)
38 const QXmlStreamAttributes &attributes = reader.attributes();
39 for (
const QXmlStreamAttribute &attribute : attributes) {
40 const auto name = attribute.name();
41 if (name == u"version"_s) {
42 setAttributeVersion(attribute.value().toString());
45 if (name == u"language"_s) {
46 setAttributeLanguage(attribute.value().toString());
49 if (name == u"displayname"_s) {
50 setAttributeDisplayname(attribute.value().toString());
53 if (name == u"idbasedtr"_s) {
54 setAttributeIdbasedtr(attribute.value() == u"true"_s);
57 if (name == u"label"_s) {
58 setAttributeLabel(attribute.value().toString());
61 if (name == u"connectslotsbyname"_s) {
62 setAttributeConnectslotsbyname(attribute.value() == u"true"_s);
65 if (name == u"stdsetdef"_s) {
66 setAttributeStdsetdef(attribute.value().toInt());
69 if (name == u"stdSetDef"_s) {
70 setAttributeStdSetDef(attribute.value().toInt());
73 reader.raiseError(
"Unexpected attribute "_L1 + name);
76 while (!reader.hasError()) {
77 switch (reader.readNext()) {
78 case QXmlStreamReader::StartElement : {
79 const auto tag = reader.name();
80 if (!tag.compare(u"author"_s, Qt::CaseInsensitive)) {
81 setElementAuthor(reader.readElementText());
84 if (!tag.compare(u"comment"_s, Qt::CaseInsensitive)) {
85 setElementComment(reader.readElementText());
88 if (!tag.compare(u"exportmacro"_s, Qt::CaseInsensitive)) {
89 setElementExportMacro(reader.readElementText());
92 if (!tag.compare(u"class"_s, Qt::CaseInsensitive)) {
93 setElementClass(reader.readElementText());
96 if (!tag.compare(u"widget"_s, Qt::CaseInsensitive)) {
97 auto *v =
new DomWidget();
102 if (!tag.compare(u"layoutdefault"_s, Qt::CaseInsensitive)) {
103 auto *v =
new DomLayoutDefault();
105 setElementLayoutDefault(v);
108 if (!tag.compare(u"layoutfunction"_s, Qt::CaseInsensitive)) {
109 auto *v =
new DomLayoutFunction();
111 setElementLayoutFunction(v);
114 if (!tag.compare(u"pixmapfunction"_s, Qt::CaseInsensitive)) {
115 setElementPixmapFunction(reader.readElementText());
118 if (!tag.compare(u"customwidgets"_s, Qt::CaseInsensitive)) {
119 auto *v =
new DomCustomWidgets();
121 setElementCustomWidgets(v);
124 if (!tag.compare(u"tabstops"_s, Qt::CaseInsensitive)) {
125 auto *v =
new DomTabStops();
127 setElementTabStops(v);
130 if (!tag.compare(u"images"_s, Qt::CaseInsensitive)) {
131 qWarning(
"Omitting deprecated element <images>.");
132 reader.skipCurrentElement();
135 if (!tag.compare(u"includes"_s, Qt::CaseInsensitive)) {
136 auto *v =
new DomIncludes();
138 setElementIncludes(v);
141 if (!tag.compare(u"resources"_s, Qt::CaseInsensitive)) {
142 auto *v =
new DomResources();
144 setElementResources(v);
147 if (!tag.compare(u"connections"_s, Qt::CaseInsensitive)) {
148 auto *v =
new DomConnections();
150 setElementConnections(v);
153 if (!tag.compare(u"designerdata"_s, Qt::CaseInsensitive)) {
154 auto *v =
new DomDesignerData();
156 setElementDesignerdata(v);
159 if (!tag.compare(u"slots"_s, Qt::CaseInsensitive)) {
160 auto *v =
new DomSlots();
165 if (!tag.compare(u"buttongroups"_s, Qt::CaseInsensitive)) {
166 auto *v =
new DomButtonGroups();
168 setElementButtonGroups(v);
171 reader.raiseError(
"Unexpected element "_L1 + tag);
174 case QXmlStreamReader::EndElement :
182void DomUI::write(QXmlStreamWriter &writer,
const QString &tagName)
const
184 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"ui") : tagName.toLower());
186 if (hasAttributeVersion())
187 writer.writeAttribute(u"version"_s, attributeVersion());
189 if (hasAttributeLanguage())
190 writer.writeAttribute(u"language"_s, attributeLanguage());
192 if (hasAttributeDisplayname())
193 writer.writeAttribute(u"displayname"_s, attributeDisplayname());
195 if (hasAttributeIdbasedtr())
196 writer.writeAttribute(u"idbasedtr"_s, (attributeIdbasedtr() ? u"true"_s : u"false"_s));
198 if (hasAttributeLabel())
199 writer.writeAttribute(u"label"_s, attributeLabel());
201 if (hasAttributeConnectslotsbyname())
202 writer.writeAttribute(u"connectslotsbyname"_s, (attributeConnectslotsbyname() ? u"true"_s : u"false"_s));
204 if (hasAttributeStdsetdef())
205 writer.writeAttribute(u"stdsetdef"_s, QString::number(attributeStdsetdef()));
207 if (hasAttributeStdSetDef())
208 writer.writeAttribute(u"stdsetdef"_s, QString::number(attributeStdSetDef()));
210 if (m_children & Author)
211 writer.writeTextElement(u"author"_s, m_author);
213 if (m_children & Comment)
214 writer.writeTextElement(u"comment"_s, m_comment);
216 if (m_children & ExportMacro)
217 writer.writeTextElement(u"exportmacro"_s, m_exportMacro);
219 if (m_children & Class)
220 writer.writeTextElement(u"class"_s, m_class);
222 if (m_children & Widget)
223 m_widget->write(writer, u"widget"_s);
225 if (m_children & LayoutDefault)
226 m_layoutDefault->write(writer, u"layoutdefault"_s);
228 if (m_children & LayoutFunction)
229 m_layoutFunction->write(writer, u"layoutfunction"_s);
231 if (m_children & PixmapFunction)
232 writer.writeTextElement(u"pixmapfunction"_s, m_pixmapFunction);
234 if (m_children & CustomWidgets)
235 m_customWidgets->write(writer, u"customwidgets"_s);
237 if (m_children & TabStops)
238 m_tabStops->write(writer, u"tabstops"_s);
240 if (m_children & Includes)
241 m_includes->write(writer, u"includes"_s);
243 if (m_children & Resources)
244 m_resources->write(writer, u"resources"_s);
246 if (m_children & Connections)
247 m_connections->write(writer, u"connections"_s);
249 if (m_children & Designerdata)
250 m_designerdata->write(writer, u"designerdata"_s);
252 if (m_children & Slots)
253 m_slots->write(writer, u"slots"_s);
255 if (m_children & ButtonGroups)
256 m_buttonGroups->write(writer, u"buttongroups"_s);
258 writer.writeEndElement();
261void DomUI::setElementAuthor(
const QString &a)
263 m_children |= Author;
267void DomUI::setElementComment(
const QString &a)
269 m_children |= Comment;
273void DomUI::setElementExportMacro(
const QString &a)
275 m_children |= ExportMacro;
279void DomUI::setElementClass(
const QString &a)
285DomWidget *DomUI::takeElementWidget()
287 DomWidget *a = m_widget;
289 m_children ^= Widget;
293void DomUI::setElementWidget(DomWidget *a)
296 m_children |= Widget;
300DomLayoutDefault *DomUI::takeElementLayoutDefault()
302 DomLayoutDefault *a = m_layoutDefault;
303 m_layoutDefault =
nullptr;
304 m_children ^= LayoutDefault;
308void DomUI::setElementLayoutDefault(DomLayoutDefault *a)
310 delete m_layoutDefault;
311 m_children |= LayoutDefault;
315DomLayoutFunction *DomUI::takeElementLayoutFunction()
317 DomLayoutFunction *a = m_layoutFunction;
318 m_layoutFunction =
nullptr;
319 m_children ^= LayoutFunction;
323void DomUI::setElementLayoutFunction(DomLayoutFunction *a)
325 delete m_layoutFunction;
326 m_children |= LayoutFunction;
327 m_layoutFunction = a;
330void DomUI::setElementPixmapFunction(
const QString &a)
332 m_children |= PixmapFunction;
333 m_pixmapFunction = a;
336DomCustomWidgets *DomUI::takeElementCustomWidgets()
338 DomCustomWidgets *a = m_customWidgets;
339 m_customWidgets =
nullptr;
340 m_children ^= CustomWidgets;
344void DomUI::setElementCustomWidgets(DomCustomWidgets *a)
346 delete m_customWidgets;
347 m_children |= CustomWidgets;
351DomTabStops *DomUI::takeElementTabStops()
353 DomTabStops *a = m_tabStops;
354 m_tabStops =
nullptr;
355 m_children ^= TabStops;
359void DomUI::setElementTabStops(DomTabStops *a)
362 m_children |= TabStops;
366DomIncludes *DomUI::takeElementIncludes()
368 DomIncludes *a = m_includes;
369 m_includes =
nullptr;
370 m_children ^= Includes;
374void DomUI::setElementIncludes(DomIncludes *a)
377 m_children |= Includes;
381DomResources *DomUI::takeElementResources()
383 DomResources *a = m_resources;
384 m_resources =
nullptr;
385 m_children ^= Resources;
389void DomUI::setElementResources(DomResources *a)
392 m_children |= Resources;
396DomConnections *DomUI::takeElementConnections()
398 DomConnections *a = m_connections;
399 m_connections =
nullptr;
400 m_children ^= Connections;
404void DomUI::setElementConnections(DomConnections *a)
406 delete m_connections;
407 m_children |= Connections;
411DomDesignerData *DomUI::takeElementDesignerdata()
413 DomDesignerData *a = m_designerdata;
414 m_designerdata =
nullptr;
415 m_children ^= Designerdata;
419void DomUI::setElementDesignerdata(DomDesignerData *a)
421 delete m_designerdata;
422 m_children |= Designerdata;
426DomSlots *DomUI::takeElementSlots()
428 DomSlots *a = m_slots;
434void DomUI::setElementSlots(DomSlots *a)
441DomButtonGroups *DomUI::takeElementButtonGroups()
443 DomButtonGroups *a = m_buttonGroups;
444 m_buttonGroups =
nullptr;
445 m_children ^= ButtonGroups;
449void DomUI::setElementButtonGroups(DomButtonGroups *a)
451 delete m_buttonGroups;
452 m_children |= ButtonGroups;
456void DomUI::clearElementAuthor()
458 m_children &= ~Author;
461void DomUI::clearElementComment()
463 m_children &= ~Comment;
466void DomUI::clearElementExportMacro()
468 m_children &= ~ExportMacro;
471void DomUI::clearElementClass()
473 m_children &= ~Class;
476void DomUI::clearElementWidget()
480 m_children &= ~Widget;
483void DomUI::clearElementLayoutDefault()
485 delete m_layoutDefault;
486 m_layoutDefault =
nullptr;
487 m_children &= ~LayoutDefault;
490void DomUI::clearElementLayoutFunction()
492 delete m_layoutFunction;
493 m_layoutFunction =
nullptr;
494 m_children &= ~LayoutFunction;
497void DomUI::clearElementPixmapFunction()
499 m_children &= ~PixmapFunction;
502void DomUI::clearElementCustomWidgets()
504 delete m_customWidgets;
505 m_customWidgets =
nullptr;
506 m_children &= ~CustomWidgets;
509void DomUI::clearElementTabStops()
512 m_tabStops =
nullptr;
513 m_children &= ~TabStops;
516void DomUI::clearElementIncludes()
519 m_includes =
nullptr;
520 m_children &= ~Includes;
523void DomUI::clearElementResources()
526 m_resources =
nullptr;
527 m_children &= ~Resources;
530void DomUI::clearElementConnections()
532 delete m_connections;
533 m_connections =
nullptr;
534 m_children &= ~Connections;
537void DomUI::clearElementDesignerdata()
539 delete m_designerdata;
540 m_designerdata =
nullptr;
541 m_children &= ~Designerdata;
544void DomUI::clearElementSlots()
548 m_children &= ~Slots;
551void DomUI::clearElementButtonGroups()
553 delete m_buttonGroups;
554 m_buttonGroups =
nullptr;
555 m_children &= ~ButtonGroups;
558DomIncludes::~DomIncludes()
560 qDeleteAll(m_include);
564void DomIncludes::read(QXmlStreamReader &reader)
566 while (!reader.hasError()) {
567 switch (reader.readNext()) {
568 case QXmlStreamReader::StartElement : {
569 const auto tag = reader.name();
570 if (!tag.compare(u"include"_s, Qt::CaseInsensitive)) {
571 auto *v =
new DomInclude();
576 reader.raiseError(
"Unexpected element "_L1 + tag);
579 case QXmlStreamReader::EndElement :
587void DomIncludes::write(QXmlStreamWriter &writer,
const QString &tagName)
const
589 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"includes") : tagName.toLower());
591 for (DomInclude *v : m_include)
592 v->write(writer, u"include"_s);
594 writer.writeEndElement();
597void DomIncludes::setElementInclude(
const QList<DomInclude *> &a)
599 m_children |= Include;
603DomInclude::~DomInclude() =
default;
605void DomInclude::read(QXmlStreamReader &reader)
607 const QXmlStreamAttributes &attributes = reader.attributes();
608 for (
const QXmlStreamAttribute &attribute : attributes) {
609 const auto name = attribute.name();
610 if (name == u"location"_s) {
611 setAttributeLocation(attribute.value().toString());
614 if (name == u"impldecl"_s) {
615 setAttributeImpldecl(attribute.value().toString());
618 reader.raiseError(
"Unexpected attribute "_L1 + name);
621 while (!reader.hasError()) {
622 switch (reader.readNext()) {
623 case QXmlStreamReader::StartElement : {
624 const auto tag = reader.name();
625 reader.raiseError(
"Unexpected element "_L1 + tag);
628 case QXmlStreamReader::EndElement :
630 case QXmlStreamReader::Characters :
631 if (!reader.isWhitespace())
632 m_text.append(reader.text().toString());
640void DomInclude::write(QXmlStreamWriter &writer,
const QString &tagName)
const
642 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"include") : tagName.toLower());
644 if (hasAttributeLocation())
645 writer.writeAttribute(u"location"_s, attributeLocation());
647 if (hasAttributeImpldecl())
648 writer.writeAttribute(u"impldecl"_s, attributeImpldecl());
650 if (!m_text.isEmpty())
651 writer.writeCharacters(m_text);
653 writer.writeEndElement();
656DomResources::~DomResources()
658 qDeleteAll(m_include);
662void DomResources::read(QXmlStreamReader &reader)
664 const QXmlStreamAttributes &attributes = reader.attributes();
665 for (
const QXmlStreamAttribute &attribute : attributes) {
666 const auto name = attribute.name();
667 if (name == u"name"_s) {
668 setAttributeName(attribute.value().toString());
671 reader.raiseError(
"Unexpected attribute "_L1 + name);
674 while (!reader.hasError()) {
675 switch (reader.readNext()) {
676 case QXmlStreamReader::StartElement : {
677 const auto tag = reader.name();
678 if (!tag.compare(u"include"_s, Qt::CaseInsensitive)) {
679 auto *v =
new DomResource();
684 reader.raiseError(
"Unexpected element "_L1 + tag);
687 case QXmlStreamReader::EndElement :
695void DomResources::write(QXmlStreamWriter &writer,
const QString &tagName)
const
697 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"resources") : tagName.toLower());
699 if (hasAttributeName())
700 writer.writeAttribute(u"name"_s, attributeName());
702 for (DomResource *v : m_include)
703 v->write(writer, u"include"_s);
705 writer.writeEndElement();
708void DomResources::setElementInclude(
const QList<DomResource *> &a)
710 m_children |= Include;
714DomResource::~DomResource() =
default;
716void DomResource::read(QXmlStreamReader &reader)
718 const QXmlStreamAttributes &attributes = reader.attributes();
719 for (
const QXmlStreamAttribute &attribute : attributes) {
720 const auto name = attribute.name();
721 if (name == u"location"_s) {
722 setAttributeLocation(attribute.value().toString());
725 reader.raiseError(
"Unexpected attribute "_L1 + name);
728 while (!reader.hasError()) {
729 switch (reader.readNext()) {
730 case QXmlStreamReader::StartElement : {
731 const auto tag = reader.name();
732 reader.raiseError(
"Unexpected element "_L1 + tag);
735 case QXmlStreamReader::EndElement :
743void DomResource::write(QXmlStreamWriter &writer,
const QString &tagName)
const
745 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"resource") : tagName.toLower());
747 if (hasAttributeLocation())
748 writer.writeAttribute(u"location"_s, attributeLocation());
750 writer.writeEndElement();
753DomActionGroup::~DomActionGroup()
755 qDeleteAll(m_action);
757 qDeleteAll(m_actionGroup);
758 m_actionGroup.clear();
759 qDeleteAll(m_property);
761 qDeleteAll(m_attribute);
765void DomActionGroup::read(QXmlStreamReader &reader)
767 const QXmlStreamAttributes &attributes = reader.attributes();
768 for (
const QXmlStreamAttribute &attribute : attributes) {
769 const auto name = attribute.name();
770 if (name == u"name"_s) {
771 setAttributeName(attribute.value().toString());
774 reader.raiseError(
"Unexpected attribute "_L1 + name);
777 while (!reader.hasError()) {
778 switch (reader.readNext()) {
779 case QXmlStreamReader::StartElement : {
780 const auto tag = reader.name();
781 if (!tag.compare(u"action"_s, Qt::CaseInsensitive)) {
782 auto *v =
new DomAction();
787 if (!tag.compare(u"actiongroup"_s, Qt::CaseInsensitive)) {
788 auto *v =
new DomActionGroup();
790 m_actionGroup.append(v);
793 if (!tag.compare(u"property"_s, Qt::CaseInsensitive)) {
794 auto *v =
new DomProperty();
796 m_property.append(v);
799 if (!tag.compare(u"attribute"_s, Qt::CaseInsensitive)) {
800 auto *v =
new DomProperty();
802 m_attribute.append(v);
805 reader.raiseError(
"Unexpected element "_L1 + tag);
808 case QXmlStreamReader::EndElement :
816void DomActionGroup::write(QXmlStreamWriter &writer,
const QString &tagName)
const
818 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"actiongroup") : tagName.toLower());
820 if (hasAttributeName())
821 writer.writeAttribute(u"name"_s, attributeName());
823 for (DomAction *v : m_action)
824 v->write(writer, u"action"_s);
826 for (DomActionGroup *v : m_actionGroup)
827 v->write(writer, u"actiongroup"_s);
829 for (DomProperty *v : m_property)
830 v->write(writer, u"property"_s);
832 for (DomProperty *v : m_attribute)
833 v->write(writer, u"attribute"_s);
835 writer.writeEndElement();
838void DomActionGroup::setElementAction(
const QList<DomAction *> &a)
840 m_children |= Action;
844void DomActionGroup::setElementActionGroup(
const QList<DomActionGroup *> &a)
846 m_children |= ActionGroup;
850void DomActionGroup::setElementProperty(
const QList<DomProperty *> &a)
852 m_children |= Property;
856void DomActionGroup::setElementAttribute(
const QList<DomProperty *> &a)
858 m_children |= Attribute;
862DomAction::~DomAction()
864 qDeleteAll(m_property);
866 qDeleteAll(m_attribute);
870void DomAction::read(QXmlStreamReader &reader)
872 const QXmlStreamAttributes &attributes = reader.attributes();
873 for (
const QXmlStreamAttribute &attribute : attributes) {
874 const auto name = attribute.name();
875 if (name == u"name"_s) {
876 setAttributeName(attribute.value().toString());
879 if (name == u"menu"_s) {
880 setAttributeMenu(attribute.value().toString());
883 reader.raiseError(
"Unexpected attribute "_L1 + name);
886 while (!reader.hasError()) {
887 switch (reader.readNext()) {
888 case QXmlStreamReader::StartElement : {
889 const auto tag = reader.name();
890 if (!tag.compare(u"property"_s, Qt::CaseInsensitive)) {
891 auto *v =
new DomProperty();
893 m_property.append(v);
896 if (!tag.compare(u"attribute"_s, Qt::CaseInsensitive)) {
897 auto *v =
new DomProperty();
899 m_attribute.append(v);
902 reader.raiseError(
"Unexpected element "_L1 + tag);
905 case QXmlStreamReader::EndElement :
913void DomAction::write(QXmlStreamWriter &writer,
const QString &tagName)
const
915 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"action") : tagName.toLower());
917 if (hasAttributeName())
918 writer.writeAttribute(u"name"_s, attributeName());
920 if (hasAttributeMenu())
921 writer.writeAttribute(u"menu"_s, attributeMenu());
923 for (DomProperty *v : m_property)
924 v->write(writer, u"property"_s);
926 for (DomProperty *v : m_attribute)
927 v->write(writer, u"attribute"_s);
929 writer.writeEndElement();
932void DomAction::setElementProperty(
const QList<DomProperty *> &a)
934 m_children |= Property;
938void DomAction::setElementAttribute(
const QList<DomProperty *> &a)
940 m_children |= Attribute;
944DomActionRef::~DomActionRef() =
default;
946void DomActionRef::read(QXmlStreamReader &reader)
948 const QXmlStreamAttributes &attributes = reader.attributes();
949 for (
const QXmlStreamAttribute &attribute : attributes) {
950 const auto name = attribute.name();
951 if (name == u"name"_s) {
952 setAttributeName(attribute.value().toString());
955 reader.raiseError(
"Unexpected attribute "_L1 + name);
958 while (!reader.hasError()) {
959 switch (reader.readNext()) {
960 case QXmlStreamReader::StartElement : {
961 const auto tag = reader.name();
962 reader.raiseError(
"Unexpected element "_L1 + tag);
965 case QXmlStreamReader::EndElement :
973void DomActionRef::write(QXmlStreamWriter &writer,
const QString &tagName)
const
975 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"actionref") : tagName.toLower());
977 if (hasAttributeName())
978 writer.writeAttribute(u"name"_s, attributeName());
980 writer.writeEndElement();
983DomButtonGroup::~DomButtonGroup()
985 qDeleteAll(m_property);
987 qDeleteAll(m_attribute);
991void DomButtonGroup::read(QXmlStreamReader &reader)
993 const QXmlStreamAttributes &attributes = reader.attributes();
994 for (
const QXmlStreamAttribute &attribute : attributes) {
995 const auto name = attribute.name();
996 if (name == u"name"_s) {
997 setAttributeName(attribute.value().toString());
1000 reader.raiseError(
"Unexpected attribute "_L1 + name);
1003 while (!reader.hasError()) {
1004 switch (reader.readNext()) {
1005 case QXmlStreamReader::StartElement : {
1006 const auto tag = reader.name();
1007 if (!tag.compare(u"property"_s, Qt::CaseInsensitive)) {
1008 auto *v =
new DomProperty();
1010 m_property.append(v);
1013 if (!tag.compare(u"attribute"_s, Qt::CaseInsensitive)) {
1014 auto *v =
new DomProperty();
1016 m_attribute.append(v);
1019 reader.raiseError(
"Unexpected element "_L1 + tag);
1022 case QXmlStreamReader::EndElement :
1030void DomButtonGroup::write(QXmlStreamWriter &writer,
const QString &tagName)
const
1032 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"buttongroup") : tagName.toLower());
1034 if (hasAttributeName())
1035 writer.writeAttribute(u"name"_s, attributeName());
1037 for (DomProperty *v : m_property)
1038 v->write(writer, u"property"_s);
1040 for (DomProperty *v : m_attribute)
1041 v->write(writer, u"attribute"_s);
1043 writer.writeEndElement();
1046void DomButtonGroup::setElementProperty(
const QList<DomProperty *> &a)
1048 m_children |= Property;
1052void DomButtonGroup::setElementAttribute(
const QList<DomProperty *> &a)
1054 m_children |= Attribute;
1058DomButtonGroups::~DomButtonGroups()
1060 qDeleteAll(m_buttonGroup);
1061 m_buttonGroup.clear();
1064void DomButtonGroups::read(QXmlStreamReader &reader)
1066 while (!reader.hasError()) {
1067 switch (reader.readNext()) {
1068 case QXmlStreamReader::StartElement : {
1069 const auto tag = reader.name();
1070 if (!tag.compare(u"buttongroup"_s, Qt::CaseInsensitive)) {
1071 auto *v =
new DomButtonGroup();
1073 m_buttonGroup.append(v);
1076 reader.raiseError(
"Unexpected element "_L1 + tag);
1079 case QXmlStreamReader::EndElement :
1087void DomButtonGroups::write(QXmlStreamWriter &writer,
const QString &tagName)
const
1089 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"buttongroups") : tagName.toLower());
1091 for (DomButtonGroup *v : m_buttonGroup)
1092 v->write(writer, u"buttongroup"_s);
1094 writer.writeEndElement();
1097void DomButtonGroups::setElementButtonGroup(
const QList<DomButtonGroup *> &a)
1099 m_children |= ButtonGroup;
1103DomCustomWidgets::~DomCustomWidgets()
1105 qDeleteAll(m_customWidget);
1106 m_customWidget.clear();
1109void DomCustomWidgets::read(QXmlStreamReader &reader)
1111 while (!reader.hasError()) {
1112 switch (reader.readNext()) {
1113 case QXmlStreamReader::StartElement : {
1114 const auto tag = reader.name();
1115 if (!tag.compare(u"customwidget"_s, Qt::CaseInsensitive)) {
1116 auto *v =
new DomCustomWidget();
1118 m_customWidget.append(v);
1121 reader.raiseError(
"Unexpected element "_L1 + tag);
1124 case QXmlStreamReader::EndElement :
1132void DomCustomWidgets::write(QXmlStreamWriter &writer,
const QString &tagName)
const
1134 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"customwidgets") : tagName.toLower());
1136 for (DomCustomWidget *v : m_customWidget)
1137 v->write(writer, u"customwidget"_s);
1139 writer.writeEndElement();
1142void DomCustomWidgets::setElementCustomWidget(
const QList<DomCustomWidget *> &a)
1144 m_children |= CustomWidget;
1148DomHeader::~DomHeader() =
default;
1150void DomHeader::read(QXmlStreamReader &reader)
1152 const QXmlStreamAttributes &attributes = reader.attributes();
1153 for (
const QXmlStreamAttribute &attribute : attributes) {
1154 const auto name = attribute.name();
1155 if (name == u"location"_s) {
1156 setAttributeLocation(attribute.value().toString());
1159 reader.raiseError(
"Unexpected attribute "_L1 + name);
1162 while (!reader.hasError()) {
1163 switch (reader.readNext()) {
1164 case QXmlStreamReader::StartElement : {
1165 const auto tag = reader.name();
1166 reader.raiseError(
"Unexpected element "_L1 + tag);
1169 case QXmlStreamReader::EndElement :
1171 case QXmlStreamReader::Characters :
1172 if (!reader.isWhitespace())
1173 m_text.append(reader.text().toString());
1181void DomHeader::write(QXmlStreamWriter &writer,
const QString &tagName)
const
1183 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"header") : tagName.toLower());
1185 if (hasAttributeLocation())
1186 writer.writeAttribute(u"location"_s, attributeLocation());
1188 if (!m_text.isEmpty())
1189 writer.writeCharacters(m_text);
1191 writer.writeEndElement();
1194DomCustomWidget::~DomCustomWidget()
1199 delete m_propertyspecifications;
1202void DomCustomWidget::read(QXmlStreamReader &reader)
1204 while (!reader.hasError()) {
1205 switch (reader.readNext()) {
1206 case QXmlStreamReader::StartElement : {
1207 const auto tag = reader.name();
1208 if (!tag.compare(u"class"_s, Qt::CaseInsensitive)) {
1209 setElementClass(reader.readElementText());
1212 if (!tag.compare(u"extends"_s, Qt::CaseInsensitive)) {
1213 setElementExtends(reader.readElementText());
1216 if (!tag.compare(u"header"_s, Qt::CaseInsensitive)) {
1217 auto *v =
new DomHeader();
1219 setElementHeader(v);
1222 if (!tag.compare(u"sizehint"_s, Qt::CaseInsensitive)) {
1223 auto *v =
new DomSize();
1225 setElementSizeHint(v);
1228 if (!tag.compare(u"addpagemethod"_s, Qt::CaseInsensitive)) {
1229 setElementAddPageMethod(reader.readElementText());
1232 if (!tag.compare(u"container"_s, Qt::CaseInsensitive)) {
1233 setElementContainer(reader.readElementText().toInt());
1236 if (!tag.compare(u"sizepolicy"_s, Qt::CaseInsensitive)) {
1237 qWarning(
"Omitting deprecated element <sizepolicy>.");
1238 reader.skipCurrentElement();
1241 if (!tag.compare(u"pixmap"_s, Qt::CaseInsensitive)) {
1242 setElementPixmap(reader.readElementText());
1245 if (!tag.compare(u"script"_s, Qt::CaseInsensitive)) {
1246 qWarning(
"Omitting deprecated element <script>.");
1247 reader.skipCurrentElement();
1250 if (!tag.compare(u"properties"_s, Qt::CaseInsensitive)) {
1251 qWarning(
"Omitting deprecated element <properties>.");
1252 reader.skipCurrentElement();
1255 if (!tag.compare(u"slots"_s, Qt::CaseInsensitive)) {
1256 auto *v =
new DomSlots();
1261 if (!tag.compare(u"propertyspecifications"_s, Qt::CaseInsensitive)) {
1262 auto *v =
new DomPropertySpecifications();
1264 setElementPropertyspecifications(v);
1267 reader.raiseError(
"Unexpected element "_L1 + tag);
1270 case QXmlStreamReader::EndElement :
1278void DomCustomWidget::write(QXmlStreamWriter &writer,
const QString &tagName)
const
1280 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"customwidget") : tagName.toLower());
1282 if (m_children & Class)
1283 writer.writeTextElement(u"class"_s, m_class);
1285 if (m_children & Extends)
1286 writer.writeTextElement(u"extends"_s, m_extends);
1288 if (m_children & Header)
1289 m_header->write(writer, u"header"_s);
1291 if (m_children & SizeHint)
1292 m_sizeHint->write(writer, u"sizehint"_s);
1294 if (m_children & AddPageMethod)
1295 writer.writeTextElement(u"addpagemethod"_s, m_addPageMethod);
1297 if (m_children & Container)
1298 writer.writeTextElement(u"container"_s, QString::number(m_container));
1300 if (m_children & Pixmap)
1301 writer.writeTextElement(u"pixmap"_s, m_pixmap);
1303 if (m_children & Slots)
1304 m_slots->write(writer, u"slots"_s);
1306 if (m_children & Propertyspecifications)
1307 m_propertyspecifications->write(writer, u"propertyspecifications"_s);
1309 writer.writeEndElement();
1312void DomCustomWidget::setElementClass(
const QString &a)
1314 m_children |= Class;
1318void DomCustomWidget::setElementExtends(
const QString &a)
1320 m_children |= Extends;
1324DomHeader *DomCustomWidget::takeElementHeader()
1326 DomHeader *a = m_header;
1328 m_children ^= Header;
1332void DomCustomWidget::setElementHeader(DomHeader *a)
1335 m_children |= Header;
1339DomSize *DomCustomWidget::takeElementSizeHint()
1341 DomSize *a = m_sizeHint;
1342 m_sizeHint =
nullptr;
1343 m_children ^= SizeHint;
1347void DomCustomWidget::setElementSizeHint(DomSize *a)
1350 m_children |= SizeHint;
1354void DomCustomWidget::setElementAddPageMethod(
const QString &a)
1356 m_children |= AddPageMethod;
1357 m_addPageMethod = a;
1360void DomCustomWidget::setElementContainer(
int a)
1362 m_children |= Container;
1366void DomCustomWidget::setElementPixmap(
const QString &a)
1368 m_children |= Pixmap;
1372DomSlots *DomCustomWidget::takeElementSlots()
1374 DomSlots *a = m_slots;
1376 m_children ^= Slots;
1380void DomCustomWidget::setElementSlots(DomSlots *a)
1383 m_children |= Slots;
1387DomPropertySpecifications *DomCustomWidget::takeElementPropertyspecifications()
1389 DomPropertySpecifications *a = m_propertyspecifications;
1390 m_propertyspecifications =
nullptr;
1391 m_children ^= Propertyspecifications;
1395void DomCustomWidget::setElementPropertyspecifications(DomPropertySpecifications *a)
1397 delete m_propertyspecifications;
1398 m_children |= Propertyspecifications;
1399 m_propertyspecifications = a;
1402void DomCustomWidget::clearElementClass()
1404 m_children &= ~Class;
1407void DomCustomWidget::clearElementExtends()
1409 m_children &= ~Extends;
1412void DomCustomWidget::clearElementHeader()
1416 m_children &= ~Header;
1419void DomCustomWidget::clearElementSizeHint()
1422 m_sizeHint =
nullptr;
1423 m_children &= ~SizeHint;
1426void DomCustomWidget::clearElementAddPageMethod()
1428 m_children &= ~AddPageMethod;
1431void DomCustomWidget::clearElementContainer()
1433 m_children &= ~Container;
1436void DomCustomWidget::clearElementPixmap()
1438 m_children &= ~Pixmap;
1441void DomCustomWidget::clearElementSlots()
1445 m_children &= ~Slots;
1448void DomCustomWidget::clearElementPropertyspecifications()
1450 delete m_propertyspecifications;
1451 m_propertyspecifications =
nullptr;
1452 m_children &= ~Propertyspecifications;
1455DomLayoutDefault::~DomLayoutDefault() =
default;
1457void DomLayoutDefault::read(QXmlStreamReader &reader)
1459 const QXmlStreamAttributes &attributes = reader.attributes();
1460 for (
const QXmlStreamAttribute &attribute : attributes) {
1461 const auto name = attribute.name();
1462 if (name == u"spacing"_s) {
1463 setAttributeSpacing(attribute.value().toInt());
1466 if (name == u"margin"_s) {
1467 setAttributeMargin(attribute.value().toInt());
1470 reader.raiseError(
"Unexpected attribute "_L1 + name);
1473 while (!reader.hasError()) {
1474 switch (reader.readNext()) {
1475 case QXmlStreamReader::StartElement : {
1476 const auto tag = reader.name();
1477 reader.raiseError(
"Unexpected element "_L1 + tag);
1480 case QXmlStreamReader::EndElement :
1488void DomLayoutDefault::write(QXmlStreamWriter &writer,
const QString &tagName)
const
1490 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"layoutdefault") : tagName.toLower());
1492 if (hasAttributeSpacing())
1493 writer.writeAttribute(u"spacing"_s, QString::number(attributeSpacing()));
1495 if (hasAttributeMargin())
1496 writer.writeAttribute(u"margin"_s, QString::number(attributeMargin()));
1498 writer.writeEndElement();
1501DomLayoutFunction::~DomLayoutFunction() =
default;
1503void DomLayoutFunction::read(QXmlStreamReader &reader)
1505 const QXmlStreamAttributes &attributes = reader.attributes();
1506 for (
const QXmlStreamAttribute &attribute : attributes) {
1507 const auto name = attribute.name();
1508 if (name == u"spacing"_s) {
1509 setAttributeSpacing(attribute.value().toString());
1512 if (name == u"margin"_s) {
1513 setAttributeMargin(attribute.value().toString());
1516 reader.raiseError(
"Unexpected attribute "_L1 + name);
1519 while (!reader.hasError()) {
1520 switch (reader.readNext()) {
1521 case QXmlStreamReader::StartElement : {
1522 const auto tag = reader.name();
1523 reader.raiseError(
"Unexpected element "_L1 + tag);
1526 case QXmlStreamReader::EndElement :
1534void DomLayoutFunction::write(QXmlStreamWriter &writer,
const QString &tagName)
const
1536 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"layoutfunction") : tagName.toLower());
1538 if (hasAttributeSpacing())
1539 writer.writeAttribute(u"spacing"_s, attributeSpacing());
1541 if (hasAttributeMargin())
1542 writer.writeAttribute(u"margin"_s, attributeMargin());
1544 writer.writeEndElement();
1547DomTabStops::~DomTabStops()
1552void DomTabStops::read(QXmlStreamReader &reader)
1554 while (!reader.hasError()) {
1555 switch (reader.readNext()) {
1556 case QXmlStreamReader::StartElement : {
1557 const auto tag = reader.name();
1558 if (!tag.compare(u"tabstop"_s, Qt::CaseInsensitive)) {
1559 m_tabStop.append(reader.readElementText());
1562 reader.raiseError(
"Unexpected element "_L1 + tag);
1565 case QXmlStreamReader::EndElement :
1573void DomTabStops::write(QXmlStreamWriter &writer,
const QString &tagName)
const
1575 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"tabstops") : tagName.toLower());
1577 for (
const QString &v : m_tabStop)
1578 writer.writeTextElement(u"tabstop"_s, v);
1580 writer.writeEndElement();
1583void DomTabStops::setElementTabStop(
const QStringList &a)
1585 m_children |= TabStop;
1589DomLayout::~DomLayout()
1591 qDeleteAll(m_property);
1593 qDeleteAll(m_attribute);
1594 m_attribute.clear();
1599void DomLayout::read(QXmlStreamReader &reader)
1601 const QXmlStreamAttributes &attributes = reader.attributes();
1602 for (
const QXmlStreamAttribute &attribute : attributes) {
1603 const auto name = attribute.name();
1604 if (name == u"class"_s) {
1605 setAttributeClass(attribute.value().toString());
1608 if (name == u"name"_s) {
1609 setAttributeName(attribute.value().toString());
1612 if (name == u"stretch"_s) {
1613 setAttributeStretch(attribute.value().toString());
1616 if (name == u"rowstretch"_s) {
1617 setAttributeRowStretch(attribute.value().toString());
1620 if (name == u"columnstretch"_s) {
1621 setAttributeColumnStretch(attribute.value().toString());
1624 if (name == u"rowminimumheight"_s) {
1625 setAttributeRowMinimumHeight(attribute.value().toString());
1628 if (name == u"columnminimumwidth"_s) {
1629 setAttributeColumnMinimumWidth(attribute.value().toString());
1632 reader.raiseError(
"Unexpected attribute "_L1 + name);
1635 while (!reader.hasError()) {
1636 switch (reader.readNext()) {
1637 case QXmlStreamReader::StartElement : {
1638 const auto tag = reader.name();
1639 if (!tag.compare(u"property"_s, Qt::CaseInsensitive)) {
1640 auto *v =
new DomProperty();
1642 m_property.append(v);
1645 if (!tag.compare(u"attribute"_s, Qt::CaseInsensitive)) {
1646 auto *v =
new DomProperty();
1648 m_attribute.append(v);
1651 if (!tag.compare(u"item"_s, Qt::CaseInsensitive)) {
1652 auto *v =
new DomLayoutItem();
1657 reader.raiseError(
"Unexpected element "_L1 + tag);
1660 case QXmlStreamReader::EndElement :
1668void DomLayout::write(QXmlStreamWriter &writer,
const QString &tagName)
const
1670 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"layout") : tagName.toLower());
1672 if (hasAttributeClass())
1673 writer.writeAttribute(u"class"_s, attributeClass());
1675 if (hasAttributeName())
1676 writer.writeAttribute(u"name"_s, attributeName());
1678 if (hasAttributeStretch())
1679 writer.writeAttribute(u"stretch"_s, attributeStretch());
1681 if (hasAttributeRowStretch())
1682 writer.writeAttribute(u"rowstretch"_s, attributeRowStretch());
1684 if (hasAttributeColumnStretch())
1685 writer.writeAttribute(u"columnstretch"_s, attributeColumnStretch());
1687 if (hasAttributeRowMinimumHeight())
1688 writer.writeAttribute(u"rowminimumheight"_s, attributeRowMinimumHeight());
1690 if (hasAttributeColumnMinimumWidth())
1691 writer.writeAttribute(u"columnminimumwidth"_s, attributeColumnMinimumWidth());
1693 for (DomProperty *v : m_property)
1694 v->write(writer, u"property"_s);
1696 for (DomProperty *v : m_attribute)
1697 v->write(writer, u"attribute"_s);
1699 for (DomLayoutItem *v : m_item)
1700 v->write(writer, u"item"_s);
1702 writer.writeEndElement();
1705void DomLayout::setElementProperty(
const QList<DomProperty *> &a)
1707 m_children |= Property;
1711void DomLayout::setElementAttribute(
const QList<DomProperty *> &a)
1713 m_children |= Attribute;
1717void DomLayout::setElementItem(
const QList<DomLayoutItem *> &a)
1723DomLayoutItem::~DomLayoutItem()
1730void DomLayoutItem::clear()
1743void DomLayoutItem::read(QXmlStreamReader &reader)
1745 const QXmlStreamAttributes &attributes = reader.attributes();
1746 for (
const QXmlStreamAttribute &attribute : attributes) {
1747 const auto name = attribute.name();
1748 if (name == u"row"_s) {
1749 setAttributeRow(attribute.value().toInt());
1752 if (name == u"column"_s) {
1753 setAttributeColumn(attribute.value().toInt());
1756 if (name == u"rowspan"_s) {
1757 setAttributeRowSpan(attribute.value().toInt());
1760 if (name == u"colspan"_s) {
1761 setAttributeColSpan(attribute.value().toInt());
1764 if (name == u"alignment"_s) {
1765 setAttributeAlignment(attribute.value().toString());
1768 reader.raiseError(
"Unexpected attribute "_L1 + name);
1771 while (!reader.hasError()) {
1772 switch (reader.readNext()) {
1773 case QXmlStreamReader::StartElement : {
1774 const auto tag = reader.name();
1775 if (!tag.compare(u"widget"_s, Qt::CaseInsensitive)) {
1776 auto *v =
new DomWidget();
1778 setElementWidget(v);
1781 if (!tag.compare(u"layout"_s, Qt::CaseInsensitive)) {
1782 auto *v =
new DomLayout();
1784 setElementLayout(v);
1787 if (!tag.compare(u"spacer"_s, Qt::CaseInsensitive)) {
1788 auto *v =
new DomSpacer();
1790 setElementSpacer(v);
1793 reader.raiseError(
"Unexpected element "_L1 + tag);
1796 case QXmlStreamReader::EndElement :
1804void DomLayoutItem::write(QXmlStreamWriter &writer,
const QString &tagName)
const
1806 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"layoutitem") : tagName.toLower());
1808 if (hasAttributeRow())
1809 writer.writeAttribute(u"row"_s, QString::number(attributeRow()));
1811 if (hasAttributeColumn())
1812 writer.writeAttribute(u"column"_s, QString::number(attributeColumn()));
1814 if (hasAttributeRowSpan())
1815 writer.writeAttribute(u"rowspan"_s, QString::number(attributeRowSpan()));
1817 if (hasAttributeColSpan())
1818 writer.writeAttribute(u"colspan"_s, QString::number(attributeColSpan()));
1820 if (hasAttributeAlignment())
1821 writer.writeAttribute(u"alignment"_s, attributeAlignment());
1825 if (m_widget !=
nullptr)
1826 m_widget->write(writer, u"widget"_s);
1830 if (m_layout !=
nullptr)
1831 m_layout->write(writer, u"layout"_s);
1835 if (m_spacer !=
nullptr)
1836 m_spacer->write(writer, u"spacer"_s);
1842 writer.writeEndElement();
1845DomWidget *DomLayoutItem::takeElementWidget()
1847 DomWidget *a = m_widget;
1852void DomLayoutItem::setElementWidget(DomWidget *a)
1859DomLayout *DomLayoutItem::takeElementLayout()
1861 DomLayout *a = m_layout;
1866void DomLayoutItem::setElementLayout(DomLayout *a)
1873DomSpacer *DomLayoutItem::takeElementSpacer()
1875 DomSpacer *a = m_spacer;
1880void DomLayoutItem::setElementSpacer(DomSpacer *a)
1889 qDeleteAll(m_property);
1893void DomRow::read(QXmlStreamReader &reader)
1895 while (!reader.hasError()) {
1896 switch (reader.readNext()) {
1897 case QXmlStreamReader::StartElement : {
1898 const auto tag = reader.name();
1899 if (!tag.compare(u"property"_s, Qt::CaseInsensitive)) {
1900 auto *v =
new DomProperty();
1902 m_property.append(v);
1905 reader.raiseError(
"Unexpected element "_L1 + tag);
1908 case QXmlStreamReader::EndElement :
1916void DomRow::write(QXmlStreamWriter &writer,
const QString &tagName)
const
1918 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"row") : tagName.toLower());
1920 for (DomProperty *v : m_property)
1921 v->write(writer, u"property"_s);
1923 writer.writeEndElement();
1926void DomRow::setElementProperty(
const QList<DomProperty *> &a)
1928 m_children |= Property;
1932DomColumn::~DomColumn()
1934 qDeleteAll(m_property);
1938void DomColumn::read(QXmlStreamReader &reader)
1940 while (!reader.hasError()) {
1941 switch (reader.readNext()) {
1942 case QXmlStreamReader::StartElement : {
1943 const auto tag = reader.name();
1944 if (!tag.compare(u"property"_s, Qt::CaseInsensitive)) {
1945 auto *v =
new DomProperty();
1947 m_property.append(v);
1950 reader.raiseError(
"Unexpected element "_L1 + tag);
1953 case QXmlStreamReader::EndElement :
1961void DomColumn::write(QXmlStreamWriter &writer,
const QString &tagName)
const
1963 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"column") : tagName.toLower());
1965 for (DomProperty *v : m_property)
1966 v->write(writer, u"property"_s);
1968 writer.writeEndElement();
1971void DomColumn::setElementProperty(
const QList<DomProperty *> &a)
1973 m_children |= Property;
1979 qDeleteAll(m_property);
1985void DomItem::read(QXmlStreamReader &reader)
1987 const QXmlStreamAttributes &attributes = reader.attributes();
1988 for (
const QXmlStreamAttribute &attribute : attributes) {
1989 const auto name = attribute.name();
1990 if (name == u"row"_s) {
1991 setAttributeRow(attribute.value().toInt());
1994 if (name == u"column"_s) {
1995 setAttributeColumn(attribute.value().toInt());
1998 reader.raiseError(
"Unexpected attribute "_L1 + name);
2001 while (!reader.hasError()) {
2002 switch (reader.readNext()) {
2003 case QXmlStreamReader::StartElement : {
2004 const auto tag = reader.name();
2005 if (!tag.compare(u"property"_s, Qt::CaseInsensitive)) {
2006 auto *v =
new DomProperty();
2008 m_property.append(v);
2011 if (!tag.compare(u"item"_s, Qt::CaseInsensitive)) {
2012 auto *v =
new DomItem();
2017 reader.raiseError(
"Unexpected element "_L1 + tag);
2020 case QXmlStreamReader::EndElement :
2028void DomItem::write(QXmlStreamWriter &writer,
const QString &tagName)
const
2030 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"item") : tagName.toLower());
2032 if (hasAttributeRow())
2033 writer.writeAttribute(u"row"_s, QString::number(attributeRow()));
2035 if (hasAttributeColumn())
2036 writer.writeAttribute(u"column"_s, QString::number(attributeColumn()));
2038 for (DomProperty *v : m_property)
2039 v->write(writer, u"property"_s);
2041 for (DomItem *v : m_item)
2042 v->write(writer, u"item"_s);
2044 writer.writeEndElement();
2047void DomItem::setElementProperty(
const QList<DomProperty *> &a)
2049 m_children |= Property;
2053void DomItem::setElementItem(
const QList<DomItem *> &a)
2059DomWidget::~DomWidget()
2062 qDeleteAll(m_property);
2064 qDeleteAll(m_attribute);
2065 m_attribute.clear();
2068 qDeleteAll(m_column);
2072 qDeleteAll(m_layout);
2074 qDeleteAll(m_widget);
2076 qDeleteAll(m_action);
2078 qDeleteAll(m_actionGroup);
2079 m_actionGroup.clear();
2080 qDeleteAll(m_addAction);
2081 m_addAction.clear();
2085void DomWidget::read(QXmlStreamReader &reader)
2087 const QXmlStreamAttributes &attributes = reader.attributes();
2088 for (
const QXmlStreamAttribute &attribute : attributes) {
2089 const auto name = attribute.name();
2090 if (name == u"class"_s) {
2091 setAttributeClass(attribute.value().toString());
2094 if (name == u"name"_s) {
2095 setAttributeName(attribute.value().toString());
2098 if (name == u"native"_s) {
2099 setAttributeNative(attribute.value() == u"true"_s);
2102 reader.raiseError(
"Unexpected attribute "_L1 + name);
2105 while (!reader.hasError()) {
2106 switch (reader.readNext()) {
2107 case QXmlStreamReader::StartElement : {
2108 const auto tag = reader.name();
2109 if (!tag.compare(u"class"_s, Qt::CaseInsensitive)) {
2110 m_class.append(reader.readElementText());
2113 if (!tag.compare(u"property"_s, Qt::CaseInsensitive)) {
2114 auto *v =
new DomProperty();
2116 m_property.append(v);
2119 if (!tag.compare(u"script"_s, Qt::CaseInsensitive)) {
2120 qWarning(
"Omitting deprecated element <script>.");
2121 reader.skipCurrentElement();
2124 if (!tag.compare(u"widgetdata"_s, Qt::CaseInsensitive)) {
2125 qWarning(
"Omitting deprecated element <widgetdata>.");
2126 reader.skipCurrentElement();
2129 if (!tag.compare(u"attribute"_s, Qt::CaseInsensitive)) {
2130 auto *v =
new DomProperty();
2132 m_attribute.append(v);
2135 if (!tag.compare(u"row"_s, Qt::CaseInsensitive)) {
2136 auto *v =
new DomRow();
2141 if (!tag.compare(u"column"_s, Qt::CaseInsensitive)) {
2142 auto *v =
new DomColumn();
2147 if (!tag.compare(u"item"_s, Qt::CaseInsensitive)) {
2148 auto *v =
new DomItem();
2153 if (!tag.compare(u"layout"_s, Qt::CaseInsensitive)) {
2154 auto *v =
new DomLayout();
2159 if (!tag.compare(u"widget"_s, Qt::CaseInsensitive)) {
2160 auto *v =
new DomWidget();
2165 if (!tag.compare(u"action"_s, Qt::CaseInsensitive)) {
2166 auto *v =
new DomAction();
2171 if (!tag.compare(u"actiongroup"_s, Qt::CaseInsensitive)) {
2172 auto *v =
new DomActionGroup();
2174 m_actionGroup.append(v);
2177 if (!tag.compare(u"addaction"_s, Qt::CaseInsensitive)) {
2178 auto *v =
new DomActionRef();
2180 m_addAction.append(v);
2183 if (!tag.compare(u"zorder"_s, Qt::CaseInsensitive)) {
2184 m_zOrder.append(reader.readElementText());
2187 reader.raiseError(
"Unexpected element "_L1 + tag);
2190 case QXmlStreamReader::EndElement :
2198void DomWidget::write(QXmlStreamWriter &writer,
const QString &tagName)
const
2200 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"widget") : tagName.toLower());
2202 if (hasAttributeClass())
2203 writer.writeAttribute(u"class"_s, attributeClass());
2205 if (hasAttributeName())
2206 writer.writeAttribute(u"name"_s, attributeName());
2208 if (hasAttributeNative())
2209 writer.writeAttribute(u"native"_s, (attributeNative() ? u"true"_s : u"false"_s));
2211 for (
const QString &v : m_class)
2212 writer.writeTextElement(u"class"_s, v);
2214 for (DomProperty *v : m_property)
2215 v->write(writer, u"property"_s);
2217 for (DomProperty *v : m_attribute)
2218 v->write(writer, u"attribute"_s);
2220 for (DomRow *v : m_row)
2221 v->write(writer, u"row"_s);
2223 for (DomColumn *v : m_column)
2224 v->write(writer, u"column"_s);
2226 for (DomItem *v : m_item)
2227 v->write(writer, u"item"_s);
2229 for (DomLayout *v : m_layout)
2230 v->write(writer, u"layout"_s);
2232 for (DomWidget *v : m_widget)
2233 v->write(writer, u"widget"_s);
2235 for (DomAction *v : m_action)
2236 v->write(writer, u"action"_s);
2238 for (DomActionGroup *v : m_actionGroup)
2239 v->write(writer, u"actiongroup"_s);
2241 for (DomActionRef *v : m_addAction)
2242 v->write(writer, u"addaction"_s);
2244 for (
const QString &v : m_zOrder)
2245 writer.writeTextElement(u"zorder"_s, v);
2247 writer.writeEndElement();
2250void DomWidget::setElementClass(
const QStringList &a)
2252 m_children |= Class;
2256void DomWidget::setElementProperty(
const QList<DomProperty *> &a)
2258 m_children |= Property;
2262void DomWidget::setElementAttribute(
const QList<DomProperty *> &a)
2264 m_children |= Attribute;
2268void DomWidget::setElementRow(
const QList<DomRow *> &a)
2274void DomWidget::setElementColumn(
const QList<DomColumn *> &a)
2276 m_children |= Column;
2280void DomWidget::setElementItem(
const QList<DomItem *> &a)
2286void DomWidget::setElementLayout(
const QList<DomLayout *> &a)
2288 m_children |= Layout;
2292void DomWidget::setElementWidget(
const QList<DomWidget *> &a)
2294 m_children |= Widget;
2298void DomWidget::setElementAction(
const QList<DomAction *> &a)
2300 m_children |= Action;
2304void DomWidget::setElementActionGroup(
const QList<DomActionGroup *> &a)
2306 m_children |= ActionGroup;
2310void DomWidget::setElementAddAction(
const QList<DomActionRef *> &a)
2312 m_children |= AddAction;
2316void DomWidget::setElementZOrder(
const QStringList &a)
2318 m_children |= ZOrder;
2322DomSpacer::~DomSpacer()
2324 qDeleteAll(m_property);
2328void DomSpacer::read(QXmlStreamReader &reader)
2330 const QXmlStreamAttributes &attributes = reader.attributes();
2331 for (
const QXmlStreamAttribute &attribute : attributes) {
2332 const auto name = attribute.name();
2333 if (name == u"name"_s) {
2334 setAttributeName(attribute.value().toString());
2337 reader.raiseError(
"Unexpected attribute "_L1 + name);
2340 while (!reader.hasError()) {
2341 switch (reader.readNext()) {
2342 case QXmlStreamReader::StartElement : {
2343 const auto tag = reader.name();
2344 if (!tag.compare(u"property"_s, Qt::CaseInsensitive)) {
2345 auto *v =
new DomProperty();
2347 m_property.append(v);
2350 reader.raiseError(
"Unexpected element "_L1 + tag);
2353 case QXmlStreamReader::EndElement :
2361void DomSpacer::write(QXmlStreamWriter &writer,
const QString &tagName)
const
2363 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"spacer") : tagName.toLower());
2365 if (hasAttributeName())
2366 writer.writeAttribute(u"name"_s, attributeName());
2368 for (DomProperty *v : m_property)
2369 v->write(writer, u"property"_s);
2371 writer.writeEndElement();
2374void DomSpacer::setElementProperty(
const QList<DomProperty *> &a)
2376 m_children |= Property;
2380DomColor::~DomColor() =
default;
2382void DomColor::read(QXmlStreamReader &reader)
2384 const QXmlStreamAttributes &attributes = reader.attributes();
2385 for (
const QXmlStreamAttribute &attribute : attributes) {
2386 const auto name = attribute.name();
2387 if (name == u"alpha"_s) {
2388 setAttributeAlpha(attribute.value().toInt());
2391 reader.raiseError(
"Unexpected attribute "_L1 + name);
2394 while (!reader.hasError()) {
2395 switch (reader.readNext()) {
2396 case QXmlStreamReader::StartElement : {
2397 const auto tag = reader.name();
2398 if (!tag.compare(u"red"_s, Qt::CaseInsensitive)) {
2399 setElementRed(reader.readElementText().toInt());
2402 if (!tag.compare(u"green"_s, Qt::CaseInsensitive)) {
2403 setElementGreen(reader.readElementText().toInt());
2406 if (!tag.compare(u"blue"_s, Qt::CaseInsensitive)) {
2407 setElementBlue(reader.readElementText().toInt());
2410 reader.raiseError(
"Unexpected element "_L1 + tag);
2413 case QXmlStreamReader::EndElement :
2421void DomColor::write(QXmlStreamWriter &writer,
const QString &tagName)
const
2423 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"color") : tagName.toLower());
2425 if (hasAttributeAlpha())
2426 writer.writeAttribute(u"alpha"_s, QString::number(attributeAlpha()));
2428 if (m_children & Red)
2429 writer.writeTextElement(u"red"_s, QString::number(m_red));
2431 if (m_children & Green)
2432 writer.writeTextElement(u"green"_s, QString::number(m_green));
2434 if (m_children & Blue)
2435 writer.writeTextElement(u"blue"_s, QString::number(m_blue));
2437 writer.writeEndElement();
2440void DomColor::setElementRed(
int a)
2446void DomColor::setElementGreen(
int a)
2448 m_children |= Green;
2452void DomColor::setElementBlue(
int a)
2458void DomColor::clearElementRed()
2463void DomColor::clearElementGreen()
2465 m_children &= ~Green;
2468void DomColor::clearElementBlue()
2470 m_children &= ~Blue;
2473DomGradientStop::~DomGradientStop()
2478void DomGradientStop::read(QXmlStreamReader &reader)
2480 const QXmlStreamAttributes &attributes = reader.attributes();
2481 for (
const QXmlStreamAttribute &attribute : attributes) {
2482 const auto name = attribute.name();
2483 if (name == u"position"_s) {
2484 setAttributePosition(attribute.value().toDouble());
2487 reader.raiseError(
"Unexpected attribute "_L1 + name);
2490 while (!reader.hasError()) {
2491 switch (reader.readNext()) {
2492 case QXmlStreamReader::StartElement : {
2493 const auto tag = reader.name();
2494 if (!tag.compare(u"color"_s, Qt::CaseInsensitive)) {
2495 auto *v =
new DomColor();
2500 reader.raiseError(
"Unexpected element "_L1 + tag);
2503 case QXmlStreamReader::EndElement :
2511void DomGradientStop::write(QXmlStreamWriter &writer,
const QString &tagName)
const
2513 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"gradientstop") : tagName.toLower());
2515 if (hasAttributePosition())
2516 writer.writeAttribute(u"position"_s, QString::number(attributePosition(),
'f', 15));
2518 if (m_children & Color)
2519 m_color->write(writer, u"color"_s);
2521 writer.writeEndElement();
2524DomColor *DomGradientStop::takeElementColor()
2526 DomColor *a = m_color;
2528 m_children ^= Color;
2532void DomGradientStop::setElementColor(DomColor *a)
2535 m_children |= Color;
2539void DomGradientStop::clearElementColor()
2543 m_children &= ~Color;
2546DomGradient::~DomGradient()
2548 qDeleteAll(m_gradientStop);
2549 m_gradientStop.clear();
2552void DomGradient::read(QXmlStreamReader &reader)
2554 const QXmlStreamAttributes &attributes = reader.attributes();
2555 for (
const QXmlStreamAttribute &attribute : attributes) {
2556 const auto name = attribute.name();
2557 if (name == u"startx"_s) {
2558 setAttributeStartX(attribute.value().toDouble());
2561 if (name == u"starty"_s) {
2562 setAttributeStartY(attribute.value().toDouble());
2565 if (name == u"endx"_s) {
2566 setAttributeEndX(attribute.value().toDouble());
2569 if (name == u"endy"_s) {
2570 setAttributeEndY(attribute.value().toDouble());
2573 if (name == u"centralx"_s) {
2574 setAttributeCentralX(attribute.value().toDouble());
2577 if (name == u"centraly"_s) {
2578 setAttributeCentralY(attribute.value().toDouble());
2581 if (name == u"focalx"_s) {
2582 setAttributeFocalX(attribute.value().toDouble());
2585 if (name == u"focaly"_s) {
2586 setAttributeFocalY(attribute.value().toDouble());
2589 if (name == u"radius"_s) {
2590 setAttributeRadius(attribute.value().toDouble());
2593 if (name == u"angle"_s) {
2594 setAttributeAngle(attribute.value().toDouble());
2597 if (name == u"type"_s) {
2598 setAttributeType(attribute.value().toString());
2601 if (name == u"spread"_s) {
2602 setAttributeSpread(attribute.value().toString());
2605 if (name == u"coordinatemode"_s) {
2606 setAttributeCoordinateMode(attribute.value().toString());
2609 reader.raiseError(
"Unexpected attribute "_L1 + name);
2612 while (!reader.hasError()) {
2613 switch (reader.readNext()) {
2614 case QXmlStreamReader::StartElement : {
2615 const auto tag = reader.name();
2616 if (!tag.compare(u"gradientstop"_s, Qt::CaseInsensitive)) {
2617 auto *v =
new DomGradientStop();
2619 m_gradientStop.append(v);
2622 reader.raiseError(
"Unexpected element "_L1 + tag);
2625 case QXmlStreamReader::EndElement :
2633void DomGradient::write(QXmlStreamWriter &writer,
const QString &tagName)
const
2635 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"gradient") : tagName.toLower());
2637 if (hasAttributeStartX())
2638 writer.writeAttribute(u"startx"_s, QString::number(attributeStartX(),
'f', 15));
2640 if (hasAttributeStartY())
2641 writer.writeAttribute(u"starty"_s, QString::number(attributeStartY(),
'f', 15));
2643 if (hasAttributeEndX())
2644 writer.writeAttribute(u"endx"_s, QString::number(attributeEndX(),
'f', 15));
2646 if (hasAttributeEndY())
2647 writer.writeAttribute(u"endy"_s, QString::number(attributeEndY(),
'f', 15));
2649 if (hasAttributeCentralX())
2650 writer.writeAttribute(u"centralx"_s, QString::number(attributeCentralX(),
'f', 15));
2652 if (hasAttributeCentralY())
2653 writer.writeAttribute(u"centraly"_s, QString::number(attributeCentralY(),
'f', 15));
2655 if (hasAttributeFocalX())
2656 writer.writeAttribute(u"focalx"_s, QString::number(attributeFocalX(),
'f', 15));
2658 if (hasAttributeFocalY())
2659 writer.writeAttribute(u"focaly"_s, QString::number(attributeFocalY(),
'f', 15));
2661 if (hasAttributeRadius())
2662 writer.writeAttribute(u"radius"_s, QString::number(attributeRadius(),
'f', 15));
2664 if (hasAttributeAngle())
2665 writer.writeAttribute(u"angle"_s, QString::number(attributeAngle(),
'f', 15));
2667 if (hasAttributeType())
2668 writer.writeAttribute(u"type"_s, attributeType());
2670 if (hasAttributeSpread())
2671 writer.writeAttribute(u"spread"_s, attributeSpread());
2673 if (hasAttributeCoordinateMode())
2674 writer.writeAttribute(u"coordinatemode"_s, attributeCoordinateMode());
2676 for (DomGradientStop *v : m_gradientStop)
2677 v->write(writer, u"gradientstop"_s);
2679 writer.writeEndElement();
2682void DomGradient::setElementGradientStop(
const QList<DomGradientStop *> &a)
2684 m_children |= GradientStop;
2688DomBrush::~DomBrush()
2695void DomBrush::clear()
2704 m_texture =
nullptr;
2705 m_gradient =
nullptr;
2708void DomBrush::read(QXmlStreamReader &reader)
2710 const QXmlStreamAttributes &attributes = reader.attributes();
2711 for (
const QXmlStreamAttribute &attribute : attributes) {
2712 const auto name = attribute.name();
2713 if (name == u"brushstyle"_s) {
2714 setAttributeBrushStyle(attribute.value().toString());
2717 reader.raiseError(
"Unexpected attribute "_L1 + name);
2720 while (!reader.hasError()) {
2721 switch (reader.readNext()) {
2722 case QXmlStreamReader::StartElement : {
2723 const auto tag = reader.name();
2724 if (!tag.compare(u"color"_s, Qt::CaseInsensitive)) {
2725 auto *v =
new DomColor();
2730 if (!tag.compare(u"texture"_s, Qt::CaseInsensitive)) {
2731 auto *v =
new DomProperty();
2733 setElementTexture(v);
2736 if (!tag.compare(u"gradient"_s, Qt::CaseInsensitive)) {
2737 auto *v =
new DomGradient();
2739 setElementGradient(v);
2742 reader.raiseError(
"Unexpected element "_L1 + tag);
2745 case QXmlStreamReader::EndElement :
2753void DomBrush::write(QXmlStreamWriter &writer,
const QString &tagName)
const
2755 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"brush") : tagName.toLower());
2757 if (hasAttributeBrushStyle())
2758 writer.writeAttribute(u"brushstyle"_s, attributeBrushStyle());
2762 if (m_color !=
nullptr)
2763 m_color->write(writer, u"color"_s);
2767 if (m_texture !=
nullptr)
2768 m_texture->write(writer, u"texture"_s);
2772 if (m_gradient !=
nullptr)
2773 m_gradient->write(writer, u"gradient"_s);
2779 writer.writeEndElement();
2782DomColor *DomBrush::takeElementColor()
2784 DomColor *a = m_color;
2789void DomBrush::setElementColor(DomColor *a)
2796DomProperty *DomBrush::takeElementTexture()
2798 DomProperty *a = m_texture;
2799 m_texture =
nullptr;
2803void DomBrush::setElementTexture(DomProperty *a)
2810DomGradient *DomBrush::takeElementGradient()
2812 DomGradient *a = m_gradient;
2813 m_gradient =
nullptr;
2817void DomBrush::setElementGradient(DomGradient *a)
2824DomColorRole::~DomColorRole()
2829void DomColorRole::read(QXmlStreamReader &reader)
2831 const QXmlStreamAttributes &attributes = reader.attributes();
2832 for (
const QXmlStreamAttribute &attribute : attributes) {
2833 const auto name = attribute.name();
2834 if (name == u"role"_s) {
2835 setAttributeRole(attribute.value().toString());
2838 reader.raiseError(
"Unexpected attribute "_L1 + name);
2841 while (!reader.hasError()) {
2842 switch (reader.readNext()) {
2843 case QXmlStreamReader::StartElement : {
2844 const auto tag = reader.name();
2845 if (!tag.compare(u"brush"_s, Qt::CaseInsensitive)) {
2846 auto *v =
new DomBrush();
2851 reader.raiseError(
"Unexpected element "_L1 + tag);
2854 case QXmlStreamReader::EndElement :
2862void DomColorRole::write(QXmlStreamWriter &writer,
const QString &tagName)
const
2864 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"colorrole") : tagName.toLower());
2866 if (hasAttributeRole())
2867 writer.writeAttribute(u"role"_s, attributeRole());
2869 if (m_children & Brush)
2870 m_brush->write(writer, u"brush"_s);
2872 writer.writeEndElement();
2875DomBrush *DomColorRole::takeElementBrush()
2877 DomBrush *a = m_brush;
2879 m_children ^= Brush;
2883void DomColorRole::setElementBrush(DomBrush *a)
2886 m_children |= Brush;
2890void DomColorRole::clearElementBrush()
2894 m_children &= ~Brush;
2897DomColorGroup::~DomColorGroup()
2899 qDeleteAll(m_colorRole);
2900 m_colorRole.clear();
2901 qDeleteAll(m_color);
2905void DomColorGroup::read(QXmlStreamReader &reader)
2907 while (!reader.hasError()) {
2908 switch (reader.readNext()) {
2909 case QXmlStreamReader::StartElement : {
2910 const auto tag = reader.name();
2911 if (!tag.compare(u"colorrole"_s, Qt::CaseInsensitive)) {
2912 auto *v =
new DomColorRole();
2914 m_colorRole.append(v);
2917 if (!tag.compare(u"color"_s, Qt::CaseInsensitive)) {
2918 auto *v =
new DomColor();
2923 reader.raiseError(
"Unexpected element "_L1 + tag);
2926 case QXmlStreamReader::EndElement :
2934void DomColorGroup::write(QXmlStreamWriter &writer,
const QString &tagName)
const
2936 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"colorgroup") : tagName.toLower());
2938 for (DomColorRole *v : m_colorRole)
2939 v->write(writer, u"colorrole"_s);
2941 for (DomColor *v : m_color)
2942 v->write(writer, u"color"_s);
2944 writer.writeEndElement();
2947void DomColorGroup::setElementColorRole(
const QList<DomColorRole *> &a)
2949 m_children |= ColorRole;
2953void DomColorGroup::setElementColor(
const QList<DomColor *> &a)
2955 m_children |= Color;
2959DomPalette::~DomPalette()
2966void DomPalette::read(QXmlStreamReader &reader)
2968 while (!reader.hasError()) {
2969 switch (reader.readNext()) {
2970 case QXmlStreamReader::StartElement : {
2971 const auto tag = reader.name();
2972 if (!tag.compare(u"active"_s, Qt::CaseInsensitive)) {
2973 auto *v =
new DomColorGroup();
2975 setElementActive(v);
2978 if (!tag.compare(u"inactive"_s, Qt::CaseInsensitive)) {
2979 auto *v =
new DomColorGroup();
2981 setElementInactive(v);
2984 if (!tag.compare(u"disabled"_s, Qt::CaseInsensitive)) {
2985 auto *v =
new DomColorGroup();
2987 setElementDisabled(v);
2990 reader.raiseError(
"Unexpected element "_L1 + tag);
2993 case QXmlStreamReader::EndElement :
3001void DomPalette::write(QXmlStreamWriter &writer,
const QString &tagName)
const
3003 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"palette") : tagName.toLower());
3005 if (m_children & Active)
3006 m_active->write(writer, u"active"_s);
3008 if (m_children & Inactive)
3009 m_inactive->write(writer, u"inactive"_s);
3011 if (m_children & Disabled)
3012 m_disabled->write(writer, u"disabled"_s);
3014 writer.writeEndElement();
3017DomColorGroup *DomPalette::takeElementActive()
3019 DomColorGroup *a = m_active;
3021 m_children ^= Active;
3025void DomPalette::setElementActive(DomColorGroup *a)
3028 m_children |= Active;
3032DomColorGroup *DomPalette::takeElementInactive()
3034 DomColorGroup *a = m_inactive;
3035 m_inactive =
nullptr;
3036 m_children ^= Inactive;
3040void DomPalette::setElementInactive(DomColorGroup *a)
3043 m_children |= Inactive;
3047DomColorGroup *DomPalette::takeElementDisabled()
3049 DomColorGroup *a = m_disabled;
3050 m_disabled =
nullptr;
3051 m_children ^= Disabled;
3055void DomPalette::setElementDisabled(DomColorGroup *a)
3058 m_children |= Disabled;
3062void DomPalette::clearElementActive()
3066 m_children &= ~Active;
3069void DomPalette::clearElementInactive()
3072 m_inactive =
nullptr;
3073 m_children &= ~Inactive;
3076void DomPalette::clearElementDisabled()
3079 m_disabled =
nullptr;
3080 m_children &= ~Disabled;
3083DomFont::~DomFont() =
default;
3085void DomFont::read(QXmlStreamReader &reader)
3087 while (!reader.hasError()) {
3088 switch (reader.readNext()) {
3089 case QXmlStreamReader::StartElement : {
3090 const auto tag = reader.name();
3091 if (!tag.compare(u"family"_s, Qt::CaseInsensitive)) {
3092 setElementFamily(reader.readElementText());
3095 if (!tag.compare(u"pointsize"_s, Qt::CaseInsensitive)) {
3096 setElementPointSize(reader.readElementText().toInt());
3099 if (!tag.compare(u"weight"_s, Qt::CaseInsensitive)) {
3100 setElementWeight(reader.readElementText().toInt());
3103 if (!tag.compare(u"italic"_s, Qt::CaseInsensitive)) {
3104 setElementItalic(reader.readElementText() == u"true"_s);
3107 if (!tag.compare(u"bold"_s, Qt::CaseInsensitive)) {
3108 setElementBold(reader.readElementText() == u"true"_s);
3111 if (!tag.compare(u"underline"_s, Qt::CaseInsensitive)) {
3112 setElementUnderline(reader.readElementText() == u"true"_s);
3115 if (!tag.compare(u"strikeout"_s, Qt::CaseInsensitive)) {
3116 setElementStrikeOut(reader.readElementText() == u"true"_s);
3119 if (!tag.compare(u"antialiasing"_s, Qt::CaseInsensitive)) {
3120 setElementAntialiasing(reader.readElementText() == u"true"_s);
3123 if (!tag.compare(u"stylestrategy"_s, Qt::CaseInsensitive)) {
3124 setElementStyleStrategy(reader.readElementText());
3127 if (!tag.compare(u"kerning"_s, Qt::CaseInsensitive)) {
3128 setElementKerning(reader.readElementText() == u"true"_s);
3131 if (!tag.compare(u"hintingpreference"_s, Qt::CaseInsensitive)) {
3132 setElementHintingPreference(reader.readElementText());
3135 if (!tag.compare(u"fontweight"_s, Qt::CaseInsensitive)) {
3136 setElementFontWeight(reader.readElementText());
3139 reader.raiseError(
"Unexpected element "_L1 + tag);
3142 case QXmlStreamReader::EndElement :
3150void DomFont::write(QXmlStreamWriter &writer,
const QString &tagName)
const
3152 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"font") : tagName.toLower());
3154 if (m_children & Family)
3155 writer.writeTextElement(u"family"_s, m_family);
3157 if (m_children & PointSize)
3158 writer.writeTextElement(u"pointsize"_s, QString::number(m_pointSize));
3160 if (m_children & Weight)
3161 writer.writeTextElement(u"weight"_s, QString::number(m_weight));
3163 if (m_children & Italic)
3164 writer.writeTextElement(u"italic"_s, (m_italic ? u"true"_s : u"false"_s));
3166 if (m_children & Bold)
3167 writer.writeTextElement(u"bold"_s, (m_bold ? u"true"_s : u"false"_s));
3169 if (m_children & Underline)
3170 writer.writeTextElement(u"underline"_s, (m_underline ? u"true"_s : u"false"_s));
3172 if (m_children & StrikeOut)
3173 writer.writeTextElement(u"strikeout"_s, (m_strikeOut ? u"true"_s : u"false"_s));
3175 if (m_children & Antialiasing)
3176 writer.writeTextElement(u"antialiasing"_s, (m_antialiasing ? u"true"_s : u"false"_s));
3178 if (m_children & StyleStrategy)
3179 writer.writeTextElement(u"stylestrategy"_s, m_styleStrategy);
3181 if (m_children & Kerning)
3182 writer.writeTextElement(u"kerning"_s, (m_kerning ? u"true"_s : u"false"_s));
3184 if (m_children & HintingPreference)
3185 writer.writeTextElement(u"hintingpreference"_s, m_hintingPreference);
3187 if (m_children & FontWeight)
3188 writer.writeTextElement(u"fontweight"_s, m_fontWeight);
3190 writer.writeEndElement();
3193void DomFont::setElementFamily(
const QString &a)
3195 m_children |= Family;
3199void DomFont::setElementPointSize(
int a)
3201 m_children |= PointSize;
3205void DomFont::setElementWeight(
int a)
3207 m_children |= Weight;
3211void DomFont::setElementItalic(
bool a)
3213 m_children |= Italic;
3217void DomFont::setElementBold(
bool a)
3223void DomFont::setElementUnderline(
bool a)
3225 m_children |= Underline;
3229void DomFont::setElementStrikeOut(
bool a)
3231 m_children |= StrikeOut;
3235void DomFont::setElementAntialiasing(
bool a)
3237 m_children |= Antialiasing;
3241void DomFont::setElementStyleStrategy(
const QString &a)
3243 m_children |= StyleStrategy;
3244 m_styleStrategy = a;
3247void DomFont::setElementKerning(
bool a)
3249 m_children |= Kerning;
3253void DomFont::setElementHintingPreference(
const QString &a)
3255 m_children |= HintingPreference;
3256 m_hintingPreference = a;
3259void DomFont::setElementFontWeight(
const QString &a)
3261 m_children |= FontWeight;
3265void DomFont::clearElementFamily()
3267 m_children &= ~Family;
3270void DomFont::clearElementPointSize()
3272 m_children &= ~PointSize;
3275void DomFont::clearElementWeight()
3277 m_children &= ~Weight;
3280void DomFont::clearElementItalic()
3282 m_children &= ~Italic;
3285void DomFont::clearElementBold()
3287 m_children &= ~Bold;
3290void DomFont::clearElementUnderline()
3292 m_children &= ~Underline;
3295void DomFont::clearElementStrikeOut()
3297 m_children &= ~StrikeOut;
3300void DomFont::clearElementAntialiasing()
3302 m_children &= ~Antialiasing;
3305void DomFont::clearElementStyleStrategy()
3307 m_children &= ~StyleStrategy;
3310void DomFont::clearElementKerning()
3312 m_children &= ~Kerning;
3315void DomFont::clearElementHintingPreference()
3317 m_children &= ~HintingPreference;
3320void DomFont::clearElementFontWeight()
3322 m_children &= ~FontWeight;
3325DomPoint::~DomPoint() =
default;
3327void DomPoint::read(QXmlStreamReader &reader)
3329 while (!reader.hasError()) {
3330 switch (reader.readNext()) {
3331 case QXmlStreamReader::StartElement : {
3332 const auto tag = reader.name();
3333 if (!tag.compare(u"x"_s, Qt::CaseInsensitive)) {
3334 setElementX(reader.readElementText().toInt());
3337 if (!tag.compare(u"y"_s, Qt::CaseInsensitive)) {
3338 setElementY(reader.readElementText().toInt());
3341 reader.raiseError(
"Unexpected element "_L1 + tag);
3344 case QXmlStreamReader::EndElement :
3352void DomPoint::write(QXmlStreamWriter &writer,
const QString &tagName)
const
3354 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"point") : tagName.toLower());
3357 writer.writeTextElement(u"x"_s, QString::number(m_x));
3360 writer.writeTextElement(u"y"_s, QString::number(m_y));
3362 writer.writeEndElement();
3365void DomPoint::setElementX(
int a)
3371void DomPoint::setElementY(
int a)
3377void DomPoint::clearElementX()
3382void DomPoint::clearElementY()
3387DomRect::~DomRect() =
default;
3389void DomRect::read(QXmlStreamReader &reader)
3391 while (!reader.hasError()) {
3392 switch (reader.readNext()) {
3393 case QXmlStreamReader::StartElement : {
3394 const auto tag = reader.name();
3395 if (!tag.compare(u"x"_s, Qt::CaseInsensitive)) {
3396 setElementX(reader.readElementText().toInt());
3399 if (!tag.compare(u"y"_s, Qt::CaseInsensitive)) {
3400 setElementY(reader.readElementText().toInt());
3403 if (!tag.compare(u"width"_s, Qt::CaseInsensitive)) {
3404 setElementWidth(reader.readElementText().toInt());
3407 if (!tag.compare(u"height"_s, Qt::CaseInsensitive)) {
3408 setElementHeight(reader.readElementText().toInt());
3411 reader.raiseError(
"Unexpected element "_L1 + tag);
3414 case QXmlStreamReader::EndElement :
3422void DomRect::write(QXmlStreamWriter &writer,
const QString &tagName)
const
3424 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"rect") : tagName.toLower());
3427 writer.writeTextElement(u"x"_s, QString::number(m_x));
3430 writer.writeTextElement(u"y"_s, QString::number(m_y));
3432 if (m_children & Width)
3433 writer.writeTextElement(u"width"_s, QString::number(m_width));
3435 if (m_children & Height)
3436 writer.writeTextElement(u"height"_s, QString::number(m_height));
3438 writer.writeEndElement();
3441void DomRect::setElementX(
int a)
3447void DomRect::setElementY(
int a)
3453void DomRect::setElementWidth(
int a)
3455 m_children |= Width;
3459void DomRect::setElementHeight(
int a)
3461 m_children |= Height;
3465void DomRect::clearElementX()
3470void DomRect::clearElementY()
3475void DomRect::clearElementWidth()
3477 m_children &= ~Width;
3480void DomRect::clearElementHeight()
3482 m_children &= ~Height;
3485DomLocale::~DomLocale() =
default;
3487void DomLocale::read(QXmlStreamReader &reader)
3489 const QXmlStreamAttributes &attributes = reader.attributes();
3490 for (
const QXmlStreamAttribute &attribute : attributes) {
3491 const auto name = attribute.name();
3492 if (name == u"language"_s) {
3493 setAttributeLanguage(attribute.value().toString());
3496 if (name == u"country"_s) {
3497 setAttributeCountry(attribute.value().toString());
3500 reader.raiseError(
"Unexpected attribute "_L1 + name);
3503 while (!reader.hasError()) {
3504 switch (reader.readNext()) {
3505 case QXmlStreamReader::StartElement : {
3506 const auto tag = reader.name();
3507 reader.raiseError(
"Unexpected element "_L1 + tag);
3510 case QXmlStreamReader::EndElement :
3518void DomLocale::write(QXmlStreamWriter &writer,
const QString &tagName)
const
3520 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"locale") : tagName.toLower());
3522 if (hasAttributeLanguage())
3523 writer.writeAttribute(u"language"_s, attributeLanguage());
3525 if (hasAttributeCountry())
3526 writer.writeAttribute(u"country"_s, attributeCountry());
3528 writer.writeEndElement();
3531DomSizePolicy::~DomSizePolicy() =
default;
3533void DomSizePolicy::read(QXmlStreamReader &reader)
3535 const QXmlStreamAttributes &attributes = reader.attributes();
3536 for (
const QXmlStreamAttribute &attribute : attributes) {
3537 const auto name = attribute.name();
3538 if (name == u"hsizetype"_s) {
3539 setAttributeHSizeType(attribute.value().toString());
3542 if (name == u"vsizetype"_s) {
3543 setAttributeVSizeType(attribute.value().toString());
3546 reader.raiseError(
"Unexpected attribute "_L1 + name);
3549 while (!reader.hasError()) {
3550 switch (reader.readNext()) {
3551 case QXmlStreamReader::StartElement : {
3552 const auto tag = reader.name();
3553 if (!tag.compare(u"hsizetype"_s, Qt::CaseInsensitive)) {
3554 setElementHSizeType(reader.readElementText().toInt());
3557 if (!tag.compare(u"vsizetype"_s, Qt::CaseInsensitive)) {
3558 setElementVSizeType(reader.readElementText().toInt());
3561 if (!tag.compare(u"horstretch"_s, Qt::CaseInsensitive)) {
3562 setElementHorStretch(reader.readElementText().toInt());
3565 if (!tag.compare(u"verstretch"_s, Qt::CaseInsensitive)) {
3566 setElementVerStretch(reader.readElementText().toInt());
3569 reader.raiseError(
"Unexpected element "_L1 + tag);
3572 case QXmlStreamReader::EndElement :
3580void DomSizePolicy::write(QXmlStreamWriter &writer,
const QString &tagName)
const
3582 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"sizepolicy") : tagName.toLower());
3584 if (hasAttributeHSizeType())
3585 writer.writeAttribute(u"hsizetype"_s, attributeHSizeType());
3587 if (hasAttributeVSizeType())
3588 writer.writeAttribute(u"vsizetype"_s, attributeVSizeType());
3590 if (m_children & HSizeType)
3591 writer.writeTextElement(u"hsizetype"_s, QString::number(m_hSizeType));
3593 if (m_children & VSizeType)
3594 writer.writeTextElement(u"vsizetype"_s, QString::number(m_vSizeType));
3596 if (m_children & HorStretch)
3597 writer.writeTextElement(u"horstretch"_s, QString::number(m_horStretch));
3599 if (m_children & VerStretch)
3600 writer.writeTextElement(u"verstretch"_s, QString::number(m_verStretch));
3602 writer.writeEndElement();
3605void DomSizePolicy::setElementHSizeType(
int a)
3607 m_children |= HSizeType;
3611void DomSizePolicy::setElementVSizeType(
int a)
3613 m_children |= VSizeType;
3617void DomSizePolicy::setElementHorStretch(
int a)
3619 m_children |= HorStretch;
3623void DomSizePolicy::setElementVerStretch(
int a)
3625 m_children |= VerStretch;
3629void DomSizePolicy::clearElementHSizeType()
3631 m_children &= ~HSizeType;
3634void DomSizePolicy::clearElementVSizeType()
3636 m_children &= ~VSizeType;
3639void DomSizePolicy::clearElementHorStretch()
3641 m_children &= ~HorStretch;
3644void DomSizePolicy::clearElementVerStretch()
3646 m_children &= ~VerStretch;
3649DomSize::~DomSize() =
default;
3651void DomSize::read(QXmlStreamReader &reader)
3653 while (!reader.hasError()) {
3654 switch (reader.readNext()) {
3655 case QXmlStreamReader::StartElement : {
3656 const auto tag = reader.name();
3657 if (!tag.compare(u"width"_s, Qt::CaseInsensitive)) {
3658 setElementWidth(reader.readElementText().toInt());
3661 if (!tag.compare(u"height"_s, Qt::CaseInsensitive)) {
3662 setElementHeight(reader.readElementText().toInt());
3665 reader.raiseError(
"Unexpected element "_L1 + tag);
3668 case QXmlStreamReader::EndElement :
3676void DomSize::write(QXmlStreamWriter &writer,
const QString &tagName)
const
3678 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"size") : tagName.toLower());
3680 if (m_children & Width)
3681 writer.writeTextElement(u"width"_s, QString::number(m_width));
3683 if (m_children & Height)
3684 writer.writeTextElement(u"height"_s, QString::number(m_height));
3686 writer.writeEndElement();
3689void DomSize::setElementWidth(
int a)
3691 m_children |= Width;
3695void DomSize::setElementHeight(
int a)
3697 m_children |= Height;
3701void DomSize::clearElementWidth()
3703 m_children &= ~Width;
3706void DomSize::clearElementHeight()
3708 m_children &= ~Height;
3711DomDate::~DomDate() =
default;
3713void DomDate::read(QXmlStreamReader &reader)
3715 while (!reader.hasError()) {
3716 switch (reader.readNext()) {
3717 case QXmlStreamReader::StartElement : {
3718 const auto tag = reader.name();
3719 if (!tag.compare(u"year"_s, Qt::CaseInsensitive)) {
3720 setElementYear(reader.readElementText().toInt());
3723 if (!tag.compare(u"month"_s, Qt::CaseInsensitive)) {
3724 setElementMonth(reader.readElementText().toInt());
3727 if (!tag.compare(u"day"_s, Qt::CaseInsensitive)) {
3728 setElementDay(reader.readElementText().toInt());
3731 reader.raiseError(
"Unexpected element "_L1 + tag);
3734 case QXmlStreamReader::EndElement :
3742void DomDate::write(QXmlStreamWriter &writer,
const QString &tagName)
const
3744 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"date") : tagName.toLower());
3746 if (m_children & Year)
3747 writer.writeTextElement(u"year"_s, QString::number(m_year));
3749 if (m_children & Month)
3750 writer.writeTextElement(u"month"_s, QString::number(m_month));
3752 if (m_children & Day)
3753 writer.writeTextElement(u"day"_s, QString::number(m_day));
3755 writer.writeEndElement();
3758void DomDate::setElementYear(
int a)
3764void DomDate::setElementMonth(
int a)
3766 m_children |= Month;
3770void DomDate::setElementDay(
int a)
3776void DomDate::clearElementYear()
3778 m_children &= ~Year;
3781void DomDate::clearElementMonth()
3783 m_children &= ~Month;
3786void DomDate::clearElementDay()
3791DomTime::~DomTime() =
default;
3793void DomTime::read(QXmlStreamReader &reader)
3795 while (!reader.hasError()) {
3796 switch (reader.readNext()) {
3797 case QXmlStreamReader::StartElement : {
3798 const auto tag = reader.name();
3799 if (!tag.compare(u"hour"_s, Qt::CaseInsensitive)) {
3800 setElementHour(reader.readElementText().toInt());
3803 if (!tag.compare(u"minute"_s, Qt::CaseInsensitive)) {
3804 setElementMinute(reader.readElementText().toInt());
3807 if (!tag.compare(u"second"_s, Qt::CaseInsensitive)) {
3808 setElementSecond(reader.readElementText().toInt());
3811 reader.raiseError(
"Unexpected element "_L1 + tag);
3814 case QXmlStreamReader::EndElement :
3822void DomTime::write(QXmlStreamWriter &writer,
const QString &tagName)
const
3824 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"time") : tagName.toLower());
3826 if (m_children & Hour)
3827 writer.writeTextElement(u"hour"_s, QString::number(m_hour));
3829 if (m_children & Minute)
3830 writer.writeTextElement(u"minute"_s, QString::number(m_minute));
3832 if (m_children & Second)
3833 writer.writeTextElement(u"second"_s, QString::number(m_second));
3835 writer.writeEndElement();
3838void DomTime::setElementHour(
int a)
3844void DomTime::setElementMinute(
int a)
3846 m_children |= Minute;
3850void DomTime::setElementSecond(
int a)
3852 m_children |= Second;
3856void DomTime::clearElementHour()
3858 m_children &= ~Hour;
3861void DomTime::clearElementMinute()
3863 m_children &= ~Minute;
3866void DomTime::clearElementSecond()
3868 m_children &= ~Second;
3871DomDateTime::~DomDateTime() =
default;
3873void DomDateTime::read(QXmlStreamReader &reader)
3875 while (!reader.hasError()) {
3876 switch (reader.readNext()) {
3877 case QXmlStreamReader::StartElement : {
3878 const auto tag = reader.name();
3879 if (!tag.compare(u"hour"_s, Qt::CaseInsensitive)) {
3880 setElementHour(reader.readElementText().toInt());
3883 if (!tag.compare(u"minute"_s, Qt::CaseInsensitive)) {
3884 setElementMinute(reader.readElementText().toInt());
3887 if (!tag.compare(u"second"_s, Qt::CaseInsensitive)) {
3888 setElementSecond(reader.readElementText().toInt());
3891 if (!tag.compare(u"year"_s, Qt::CaseInsensitive)) {
3892 setElementYear(reader.readElementText().toInt());
3895 if (!tag.compare(u"month"_s, Qt::CaseInsensitive)) {
3896 setElementMonth(reader.readElementText().toInt());
3899 if (!tag.compare(u"day"_s, Qt::CaseInsensitive)) {
3900 setElementDay(reader.readElementText().toInt());
3903 reader.raiseError(
"Unexpected element "_L1 + tag);
3906 case QXmlStreamReader::EndElement :
3914void DomDateTime::write(QXmlStreamWriter &writer,
const QString &tagName)
const
3916 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"datetime") : tagName.toLower());
3918 if (m_children & Hour)
3919 writer.writeTextElement(u"hour"_s, QString::number(m_hour));
3921 if (m_children & Minute)
3922 writer.writeTextElement(u"minute"_s, QString::number(m_minute));
3924 if (m_children & Second)
3925 writer.writeTextElement(u"second"_s, QString::number(m_second));
3927 if (m_children & Year)
3928 writer.writeTextElement(u"year"_s, QString::number(m_year));
3930 if (m_children & Month)
3931 writer.writeTextElement(u"month"_s, QString::number(m_month));
3933 if (m_children & Day)
3934 writer.writeTextElement(u"day"_s, QString::number(m_day));
3936 writer.writeEndElement();
3939void DomDateTime::setElementHour(
int a)
3945void DomDateTime::setElementMinute(
int a)
3947 m_children |= Minute;
3951void DomDateTime::setElementSecond(
int a)
3953 m_children |= Second;
3957void DomDateTime::setElementYear(
int a)
3963void DomDateTime::setElementMonth(
int a)
3965 m_children |= Month;
3969void DomDateTime::setElementDay(
int a)
3975void DomDateTime::clearElementHour()
3977 m_children &= ~Hour;
3980void DomDateTime::clearElementMinute()
3982 m_children &= ~Minute;
3985void DomDateTime::clearElementSecond()
3987 m_children &= ~Second;
3990void DomDateTime::clearElementYear()
3992 m_children &= ~Year;
3995void DomDateTime::clearElementMonth()
3997 m_children &= ~Month;
4000void DomDateTime::clearElementDay()
4005DomStringList::~DomStringList()
4010void DomStringList::read(QXmlStreamReader &reader)
4012 const QXmlStreamAttributes &attributes = reader.attributes();
4013 for (
const QXmlStreamAttribute &attribute : attributes) {
4014 const auto name = attribute.name();
4015 if (name == u"notr"_s) {
4016 setAttributeNotr(attribute.value().toString());
4019 if (name == u"comment"_s) {
4020 setAttributeComment(attribute.value().toString());
4023 if (name == u"extracomment"_s) {
4024 setAttributeExtraComment(attribute.value().toString());
4027 if (name == u"id"_s) {
4028 setAttributeId(attribute.value().toString());
4031 reader.raiseError(
"Unexpected attribute "_L1 + name);
4034 while (!reader.hasError()) {
4035 switch (reader.readNext()) {
4036 case QXmlStreamReader::StartElement : {
4037 const auto tag = reader.name();
4038 if (!tag.compare(u"string"_s, Qt::CaseInsensitive)) {
4039 m_string.append(reader.readElementText());
4042 reader.raiseError(
"Unexpected element "_L1 + tag);
4045 case QXmlStreamReader::EndElement :
4053void DomStringList::write(QXmlStreamWriter &writer,
const QString &tagName)
const
4055 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"stringlist") : tagName.toLower());
4057 if (hasAttributeNotr())
4058 writer.writeAttribute(u"notr"_s, attributeNotr());
4060 if (hasAttributeComment())
4061 writer.writeAttribute(u"comment"_s, attributeComment());
4063 if (hasAttributeExtraComment())
4064 writer.writeAttribute(u"extracomment"_s, attributeExtraComment());
4066 if (hasAttributeId())
4067 writer.writeAttribute(u"id"_s, attributeId());
4069 for (
const QString &v : m_string)
4070 writer.writeTextElement(u"string"_s, v);
4072 writer.writeEndElement();
4075void DomStringList::setElementString(
const QStringList &a)
4077 m_children |= String;
4081DomResourcePixmap::~DomResourcePixmap() =
default;
4083void DomResourcePixmap::read(QXmlStreamReader &reader)
4085 const QXmlStreamAttributes &attributes = reader.attributes();
4086 for (
const QXmlStreamAttribute &attribute : attributes) {
4087 const auto name = attribute.name();
4088 if (name == u"resource"_s) {
4089 setAttributeResource(attribute.value().toString());
4092 if (name == u"alias"_s) {
4093 setAttributeAlias(attribute.value().toString());
4096 reader.raiseError(
"Unexpected attribute "_L1 + name);
4099 while (!reader.hasError()) {
4100 switch (reader.readNext()) {
4101 case QXmlStreamReader::StartElement : {
4102 const auto tag = reader.name();
4103 reader.raiseError(
"Unexpected element "_L1 + tag);
4106 case QXmlStreamReader::EndElement :
4108 case QXmlStreamReader::Characters :
4109 if (!reader.isWhitespace())
4110 m_text.append(reader.text().toString());
4118void DomResourcePixmap::write(QXmlStreamWriter &writer,
const QString &tagName)
const
4120 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"resourcepixmap") : tagName.toLower());
4122 if (hasAttributeResource())
4123 writer.writeAttribute(u"resource"_s, attributeResource());
4125 if (hasAttributeAlias())
4126 writer.writeAttribute(u"alias"_s, attributeAlias());
4128 if (!m_text.isEmpty())
4129 writer.writeCharacters(m_text);
4131 writer.writeEndElement();
4134DomResourceIcon::~DomResourceIcon()
4138 delete m_disabledOff;
4139 delete m_disabledOn;
4142 delete m_selectedOff;
4143 delete m_selectedOn;
4146void DomResourceIcon::read(QXmlStreamReader &reader)
4148 const QXmlStreamAttributes &attributes = reader.attributes();
4149 for (
const QXmlStreamAttribute &attribute : attributes) {
4150 const auto name = attribute.name();
4151 if (name == u"theme"_s) {
4152 setAttributeTheme(attribute.value().toString());
4155 if (name == u"resource"_s) {
4156 setAttributeResource(attribute.value().toString());
4159 reader.raiseError(
"Unexpected attribute "_L1 + name);
4162 while (!reader.hasError()) {
4163 switch (reader.readNext()) {
4164 case QXmlStreamReader::StartElement : {
4165 const auto tag = reader.name();
4166 if (!tag.compare(u"normaloff"_s, Qt::CaseInsensitive)) {
4167 auto *v =
new DomResourcePixmap();
4169 setElementNormalOff(v);
4172 if (!tag.compare(u"normalon"_s, Qt::CaseInsensitive)) {
4173 auto *v =
new DomResourcePixmap();
4175 setElementNormalOn(v);
4178 if (!tag.compare(u"disabledoff"_s, Qt::CaseInsensitive)) {
4179 auto *v =
new DomResourcePixmap();
4181 setElementDisabledOff(v);
4184 if (!tag.compare(u"disabledon"_s, Qt::CaseInsensitive)) {
4185 auto *v =
new DomResourcePixmap();
4187 setElementDisabledOn(v);
4190 if (!tag.compare(u"activeoff"_s, Qt::CaseInsensitive)) {
4191 auto *v =
new DomResourcePixmap();
4193 setElementActiveOff(v);
4196 if (!tag.compare(u"activeon"_s, Qt::CaseInsensitive)) {
4197 auto *v =
new DomResourcePixmap();
4199 setElementActiveOn(v);
4202 if (!tag.compare(u"selectedoff"_s, Qt::CaseInsensitive)) {
4203 auto *v =
new DomResourcePixmap();
4205 setElementSelectedOff(v);
4208 if (!tag.compare(u"selectedon"_s, Qt::CaseInsensitive)) {
4209 auto *v =
new DomResourcePixmap();
4211 setElementSelectedOn(v);
4214 reader.raiseError(
"Unexpected element "_L1 + tag);
4217 case QXmlStreamReader::EndElement :
4219 case QXmlStreamReader::Characters :
4220 if (!reader.isWhitespace())
4221 m_text.append(reader.text().toString());
4229void DomResourceIcon::write(QXmlStreamWriter &writer,
const QString &tagName)
const
4231 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"resourceicon") : tagName.toLower());
4233 if (hasAttributeTheme())
4234 writer.writeAttribute(u"theme"_s, attributeTheme());
4236 if (hasAttributeResource())
4237 writer.writeAttribute(u"resource"_s, attributeResource());
4239 if (m_children & NormalOff)
4240 m_normalOff->write(writer, u"normaloff"_s);
4242 if (m_children & NormalOn)
4243 m_normalOn->write(writer, u"normalon"_s);
4245 if (m_children & DisabledOff)
4246 m_disabledOff->write(writer, u"disabledoff"_s);
4248 if (m_children & DisabledOn)
4249 m_disabledOn->write(writer, u"disabledon"_s);
4251 if (m_children & ActiveOff)
4252 m_activeOff->write(writer, u"activeoff"_s);
4254 if (m_children & ActiveOn)
4255 m_activeOn->write(writer, u"activeon"_s);
4257 if (m_children & SelectedOff)
4258 m_selectedOff->write(writer, u"selectedoff"_s);
4260 if (m_children & SelectedOn)
4261 m_selectedOn->write(writer, u"selectedon"_s);
4263 if (!m_text.isEmpty())
4264 writer.writeCharacters(m_text);
4266 writer.writeEndElement();
4269DomResourcePixmap *DomResourceIcon::takeElementNormalOff()
4271 DomResourcePixmap *a = m_normalOff;
4272 m_normalOff =
nullptr;
4273 m_children ^= NormalOff;
4277void DomResourceIcon::setElementNormalOff(DomResourcePixmap *a)
4280 m_children |= NormalOff;
4284DomResourcePixmap *DomResourceIcon::takeElementNormalOn()
4286 DomResourcePixmap *a = m_normalOn;
4287 m_normalOn =
nullptr;
4288 m_children ^= NormalOn;
4292void DomResourceIcon::setElementNormalOn(DomResourcePixmap *a)
4295 m_children |= NormalOn;
4299DomResourcePixmap *DomResourceIcon::takeElementDisabledOff()
4301 DomResourcePixmap *a = m_disabledOff;
4302 m_disabledOff =
nullptr;
4303 m_children ^= DisabledOff;
4307void DomResourceIcon::setElementDisabledOff(DomResourcePixmap *a)
4309 delete m_disabledOff;
4310 m_children |= DisabledOff;
4314DomResourcePixmap *DomResourceIcon::takeElementDisabledOn()
4316 DomResourcePixmap *a = m_disabledOn;
4317 m_disabledOn =
nullptr;
4318 m_children ^= DisabledOn;
4322void DomResourceIcon::setElementDisabledOn(DomResourcePixmap *a)
4324 delete m_disabledOn;
4325 m_children |= DisabledOn;
4329DomResourcePixmap *DomResourceIcon::takeElementActiveOff()
4331 DomResourcePixmap *a = m_activeOff;
4332 m_activeOff =
nullptr;
4333 m_children ^= ActiveOff;
4337void DomResourceIcon::setElementActiveOff(DomResourcePixmap *a)
4340 m_children |= ActiveOff;
4344DomResourcePixmap *DomResourceIcon::takeElementActiveOn()
4346 DomResourcePixmap *a = m_activeOn;
4347 m_activeOn =
nullptr;
4348 m_children ^= ActiveOn;
4352void DomResourceIcon::setElementActiveOn(DomResourcePixmap *a)
4355 m_children |= ActiveOn;
4359DomResourcePixmap *DomResourceIcon::takeElementSelectedOff()
4361 DomResourcePixmap *a = m_selectedOff;
4362 m_selectedOff =
nullptr;
4363 m_children ^= SelectedOff;
4367void DomResourceIcon::setElementSelectedOff(DomResourcePixmap *a)
4369 delete m_selectedOff;
4370 m_children |= SelectedOff;
4374DomResourcePixmap *DomResourceIcon::takeElementSelectedOn()
4376 DomResourcePixmap *a = m_selectedOn;
4377 m_selectedOn =
nullptr;
4378 m_children ^= SelectedOn;
4382void DomResourceIcon::setElementSelectedOn(DomResourcePixmap *a)
4384 delete m_selectedOn;
4385 m_children |= SelectedOn;
4389void DomResourceIcon::clearElementNormalOff()
4392 m_normalOff =
nullptr;
4393 m_children &= ~NormalOff;
4396void DomResourceIcon::clearElementNormalOn()
4399 m_normalOn =
nullptr;
4400 m_children &= ~NormalOn;
4403void DomResourceIcon::clearElementDisabledOff()
4405 delete m_disabledOff;
4406 m_disabledOff =
nullptr;
4407 m_children &= ~DisabledOff;
4410void DomResourceIcon::clearElementDisabledOn()
4412 delete m_disabledOn;
4413 m_disabledOn =
nullptr;
4414 m_children &= ~DisabledOn;
4417void DomResourceIcon::clearElementActiveOff()
4420 m_activeOff =
nullptr;
4421 m_children &= ~ActiveOff;
4424void DomResourceIcon::clearElementActiveOn()
4427 m_activeOn =
nullptr;
4428 m_children &= ~ActiveOn;
4431void DomResourceIcon::clearElementSelectedOff()
4433 delete m_selectedOff;
4434 m_selectedOff =
nullptr;
4435 m_children &= ~SelectedOff;
4438void DomResourceIcon::clearElementSelectedOn()
4440 delete m_selectedOn;
4441 m_selectedOn =
nullptr;
4442 m_children &= ~SelectedOn;
4445DomString::~DomString() =
default;
4447void DomString::read(QXmlStreamReader &reader)
4449 const QXmlStreamAttributes &attributes = reader.attributes();
4450 for (
const QXmlStreamAttribute &attribute : attributes) {
4451 const auto name = attribute.name();
4452 if (name == u"notr"_s) {
4453 setAttributeNotr(attribute.value().toString());
4456 if (name == u"comment"_s) {
4457 setAttributeComment(attribute.value().toString());
4460 if (name == u"extracomment"_s) {
4461 setAttributeExtraComment(attribute.value().toString());
4464 if (name == u"id"_s) {
4465 setAttributeId(attribute.value().toString());
4468 reader.raiseError(
"Unexpected attribute "_L1 + name);
4471 while (!reader.hasError()) {
4472 switch (reader.readNext()) {
4473 case QXmlStreamReader::StartElement : {
4474 const auto tag = reader.name();
4475 reader.raiseError(
"Unexpected element "_L1 + tag);
4478 case QXmlStreamReader::EndElement :
4480 case QXmlStreamReader::Characters :
4481 if (!reader.isWhitespace())
4482 m_text.append(reader.text().toString());
4490void DomString::write(QXmlStreamWriter &writer,
const QString &tagName)
const
4492 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"string") : tagName.toLower());
4494 if (hasAttributeNotr())
4495 writer.writeAttribute(u"notr"_s, attributeNotr());
4497 if (hasAttributeComment())
4498 writer.writeAttribute(u"comment"_s, attributeComment());
4500 if (hasAttributeExtraComment())
4501 writer.writeAttribute(u"extracomment"_s, attributeExtraComment());
4503 if (hasAttributeId())
4504 writer.writeAttribute(u"id"_s, attributeId());
4506 if (!m_text.isEmpty())
4507 writer.writeCharacters(m_text);
4509 writer.writeEndElement();
4512DomPointF::~DomPointF() =
default;
4514void DomPointF::read(QXmlStreamReader &reader)
4516 while (!reader.hasError()) {
4517 switch (reader.readNext()) {
4518 case QXmlStreamReader::StartElement : {
4519 const auto tag = reader.name();
4520 if (!tag.compare(u"x"_s, Qt::CaseInsensitive)) {
4521 setElementX(reader.readElementText().toDouble());
4524 if (!tag.compare(u"y"_s, Qt::CaseInsensitive)) {
4525 setElementY(reader.readElementText().toDouble());
4528 reader.raiseError(
"Unexpected element "_L1 + tag);
4531 case QXmlStreamReader::EndElement :
4539void DomPointF::write(QXmlStreamWriter &writer,
const QString &tagName)
const
4541 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"pointf") : tagName.toLower());
4544 writer.writeTextElement(u"x"_s, QString::number(m_x,
'f', 15));
4547 writer.writeTextElement(u"y"_s, QString::number(m_y,
'f', 15));
4549 writer.writeEndElement();
4552void DomPointF::setElementX(
double a)
4558void DomPointF::setElementY(
double a)
4564void DomPointF::clearElementX()
4569void DomPointF::clearElementY()
4574DomRectF::~DomRectF() =
default;
4576void DomRectF::read(QXmlStreamReader &reader)
4578 while (!reader.hasError()) {
4579 switch (reader.readNext()) {
4580 case QXmlStreamReader::StartElement : {
4581 const auto tag = reader.name();
4582 if (!tag.compare(u"x"_s, Qt::CaseInsensitive)) {
4583 setElementX(reader.readElementText().toDouble());
4586 if (!tag.compare(u"y"_s, Qt::CaseInsensitive)) {
4587 setElementY(reader.readElementText().toDouble());
4590 if (!tag.compare(u"width"_s, Qt::CaseInsensitive)) {
4591 setElementWidth(reader.readElementText().toDouble());
4594 if (!tag.compare(u"height"_s, Qt::CaseInsensitive)) {
4595 setElementHeight(reader.readElementText().toDouble());
4598 reader.raiseError(
"Unexpected element "_L1 + tag);
4601 case QXmlStreamReader::EndElement :
4609void DomRectF::write(QXmlStreamWriter &writer,
const QString &tagName)
const
4611 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"rectf") : tagName.toLower());
4614 writer.writeTextElement(u"x"_s, QString::number(m_x,
'f', 15));
4617 writer.writeTextElement(u"y"_s, QString::number(m_y,
'f', 15));
4619 if (m_children & Width)
4620 writer.writeTextElement(u"width"_s, QString::number(m_width,
'f', 15));
4622 if (m_children & Height)
4623 writer.writeTextElement(u"height"_s, QString::number(m_height,
'f', 15));
4625 writer.writeEndElement();
4628void DomRectF::setElementX(
double a)
4634void DomRectF::setElementY(
double a)
4640void DomRectF::setElementWidth(
double a)
4642 m_children |= Width;
4646void DomRectF::setElementHeight(
double a)
4648 m_children |= Height;
4652void DomRectF::clearElementX()
4657void DomRectF::clearElementY()
4662void DomRectF::clearElementWidth()
4664 m_children &= ~Width;
4667void DomRectF::clearElementHeight()
4669 m_children &= ~Height;
4672DomSizeF::~DomSizeF() =
default;
4674void DomSizeF::read(QXmlStreamReader &reader)
4676 while (!reader.hasError()) {
4677 switch (reader.readNext()) {
4678 case QXmlStreamReader::StartElement : {
4679 const auto tag = reader.name();
4680 if (!tag.compare(u"width"_s, Qt::CaseInsensitive)) {
4681 setElementWidth(reader.readElementText().toDouble());
4684 if (!tag.compare(u"height"_s, Qt::CaseInsensitive)) {
4685 setElementHeight(reader.readElementText().toDouble());
4688 reader.raiseError(
"Unexpected element "_L1 + tag);
4691 case QXmlStreamReader::EndElement :
4699void DomSizeF::write(QXmlStreamWriter &writer,
const QString &tagName)
const
4701 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"sizef") : tagName.toLower());
4703 if (m_children & Width)
4704 writer.writeTextElement(u"width"_s, QString::number(m_width,
'f', 15));
4706 if (m_children & Height)
4707 writer.writeTextElement(u"height"_s, QString::number(m_height,
'f', 15));
4709 writer.writeEndElement();
4712void DomSizeF::setElementWidth(
double a)
4714 m_children |= Width;
4718void DomSizeF::setElementHeight(
double a)
4720 m_children |= Height;
4724void DomSizeF::clearElementWidth()
4726 m_children &= ~Width;
4729void DomSizeF::clearElementHeight()
4731 m_children &= ~Height;
4734DomChar::~DomChar() =
default;
4736void DomChar::read(QXmlStreamReader &reader)
4738 while (!reader.hasError()) {
4739 switch (reader.readNext()) {
4740 case QXmlStreamReader::StartElement : {
4741 const auto tag = reader.name();
4742 if (!tag.compare(u"unicode"_s, Qt::CaseInsensitive)) {
4743 setElementUnicode(reader.readElementText().toInt());
4746 reader.raiseError(
"Unexpected element "_L1 + tag);
4749 case QXmlStreamReader::EndElement :
4757void DomChar::write(QXmlStreamWriter &writer,
const QString &tagName)
const
4759 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"char") : tagName.toLower());
4761 if (m_children & Unicode)
4762 writer.writeTextElement(u"unicode"_s, QString::number(m_unicode));
4764 writer.writeEndElement();
4767void DomChar::setElementUnicode(
int a)
4769 m_children |= Unicode;
4773void DomChar::clearElementUnicode()
4775 m_children &= ~Unicode;
4783void DomUrl::read(QXmlStreamReader &reader)
4785 while (!reader.hasError()) {
4786 switch (reader.readNext()) {
4787 case QXmlStreamReader::StartElement : {
4788 const auto tag = reader.name();
4789 if (!tag.compare(u"string"_s, Qt::CaseInsensitive)) {
4790 auto *v =
new DomString();
4792 setElementString(v);
4795 reader.raiseError(
"Unexpected element "_L1 + tag);
4798 case QXmlStreamReader::EndElement :
4806void DomUrl::write(QXmlStreamWriter &writer,
const QString &tagName)
const
4808 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"url") : tagName.toLower());
4810 if (m_children & String)
4811 m_string->write(writer, u"string"_s);
4813 writer.writeEndElement();
4816DomString *DomUrl::takeElementString()
4818 DomString *a = m_string;
4820 m_children ^= String;
4824void DomUrl::setElementString(DomString *a)
4827 m_children |= String;
4831void DomUrl::clearElementString()
4835 m_children &= ~String;
4838DomProperty::~DomProperty()
4848 delete m_sizePolicy;
4851 delete m_stringList;
4863void DomProperty::clear()
4873 delete m_sizePolicy;
4876 delete m_stringList;
4892 m_iconSet =
nullptr;
4894 m_palette =
nullptr;
4898 m_sizePolicy =
nullptr;
4901 m_stringList =
nullptr;
4907 m_dateTime =
nullptr;
4919void DomProperty::read(QXmlStreamReader &reader)
4921 const QXmlStreamAttributes &attributes = reader.attributes();
4922 for (
const QXmlStreamAttribute &attribute : attributes) {
4923 const auto name = attribute.name();
4924 if (name == u"name"_s) {
4925 setAttributeName(attribute.value().toString());
4928 if (name == u"stdset"_s) {
4929 setAttributeStdset(attribute.value().toInt());
4932 reader.raiseError(
"Unexpected attribute "_L1 + name);
4935 while (!reader.hasError()) {
4936 switch (reader.readNext()) {
4937 case QXmlStreamReader::StartElement : {
4938 const auto tag = reader.name();
4939 if (!tag.compare(u"bool"_s, Qt::CaseInsensitive)) {
4940 setElementBool(reader.readElementText());
4943 if (!tag.compare(u"color"_s, Qt::CaseInsensitive)) {
4944 auto *v =
new DomColor();
4949 if (!tag.compare(u"cstring"_s, Qt::CaseInsensitive)) {
4950 setElementCstring(reader.readElementText());
4953 if (!tag.compare(u"cursor"_s, Qt::CaseInsensitive)) {
4954 setElementCursor(reader.readElementText().toInt());
4957 if (!tag.compare(u"cursorshape"_s, Qt::CaseInsensitive)) {
4958 setElementCursorShape(reader.readElementText());
4961 if (!tag.compare(u"enum"_s, Qt::CaseInsensitive)) {
4962 setElementEnum(reader.readElementText());
4965 if (!tag.compare(u"font"_s, Qt::CaseInsensitive)) {
4966 auto *v =
new DomFont();
4971 if (!tag.compare(u"iconset"_s, Qt::CaseInsensitive)) {
4972 auto *v =
new DomResourceIcon();
4974 setElementIconSet(v);
4977 if (!tag.compare(u"pixmap"_s, Qt::CaseInsensitive)) {
4978 auto *v =
new DomResourcePixmap();
4980 setElementPixmap(v);
4983 if (!tag.compare(u"palette"_s, Qt::CaseInsensitive)) {
4984 auto *v =
new DomPalette();
4986 setElementPalette(v);
4989 if (!tag.compare(u"point"_s, Qt::CaseInsensitive)) {
4990 auto *v =
new DomPoint();
4995 if (!tag.compare(u"rect"_s, Qt::CaseInsensitive)) {
4996 auto *v =
new DomRect();
5001 if (!tag.compare(u"set"_s, Qt::CaseInsensitive)) {
5002 setElementSet(reader.readElementText());
5005 if (!tag.compare(u"locale"_s, Qt::CaseInsensitive)) {
5006 auto *v =
new DomLocale();
5008 setElementLocale(v);
5011 if (!tag.compare(u"sizepolicy"_s, Qt::CaseInsensitive)) {
5012 auto *v =
new DomSizePolicy();
5014 setElementSizePolicy(v);
5017 if (!tag.compare(u"size"_s, Qt::CaseInsensitive)) {
5018 auto *v =
new DomSize();
5023 if (!tag.compare(u"string"_s, Qt::CaseInsensitive)) {
5024 auto *v =
new DomString();
5026 setElementString(v);
5029 if (!tag.compare(u"stringlist"_s, Qt::CaseInsensitive)) {
5030 auto *v =
new DomStringList();
5032 setElementStringList(v);
5035 if (!tag.compare(u"number"_s, Qt::CaseInsensitive)) {
5036 setElementNumber(reader.readElementText().toInt());
5039 if (!tag.compare(u"float"_s, Qt::CaseInsensitive)) {
5040 setElementFloat(reader.readElementText().toFloat());
5043 if (!tag.compare(u"double"_s, Qt::CaseInsensitive)) {
5044 setElementDouble(reader.readElementText().toDouble());
5047 if (!tag.compare(u"date"_s, Qt::CaseInsensitive)) {
5048 auto *v =
new DomDate();
5053 if (!tag.compare(u"time"_s, Qt::CaseInsensitive)) {
5054 auto *v =
new DomTime();
5059 if (!tag.compare(u"datetime"_s, Qt::CaseInsensitive)) {
5060 auto *v =
new DomDateTime();
5062 setElementDateTime(v);
5065 if (!tag.compare(u"pointf"_s, Qt::CaseInsensitive)) {
5066 auto *v =
new DomPointF();
5068 setElementPointF(v);
5071 if (!tag.compare(u"rectf"_s, Qt::CaseInsensitive)) {
5072 auto *v =
new DomRectF();
5077 if (!tag.compare(u"sizef"_s, Qt::CaseInsensitive)) {
5078 auto *v =
new DomSizeF();
5083 if (!tag.compare(u"longlong"_s, Qt::CaseInsensitive)) {
5084 setElementLongLong(reader.readElementText().toLongLong());
5087 if (!tag.compare(u"char"_s, Qt::CaseInsensitive)) {
5088 auto *v =
new DomChar();
5093 if (!tag.compare(u"url"_s, Qt::CaseInsensitive)) {
5094 auto *v =
new DomUrl();
5099 if (!tag.compare(u"uint"_s, Qt::CaseInsensitive)) {
5100 setElementUInt(reader.readElementText().toUInt());
5103 if (!tag.compare(u"ulonglong"_s, Qt::CaseInsensitive)) {
5104 setElementULongLong(reader.readElementText().toULongLong());
5107 if (!tag.compare(u"brush"_s, Qt::CaseInsensitive)) {
5108 auto *v =
new DomBrush();
5113 reader.raiseError(
"Unexpected element "_L1 + tag);
5116 case QXmlStreamReader::EndElement :
5124void DomProperty::write(QXmlStreamWriter &writer,
const QString &tagName)
const
5126 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"property") : tagName.toLower());
5128 if (hasAttributeName())
5129 writer.writeAttribute(u"name"_s, attributeName());
5131 if (hasAttributeStdset())
5132 writer.writeAttribute(u"stdset"_s, QString::number(attributeStdset()));
5136 writer.writeTextElement(u"bool"_s, elementBool());
5140 if (m_color !=
nullptr)
5141 m_color->write(writer, u"color"_s);
5145 writer.writeTextElement(u"cstring"_s, elementCstring());
5149 writer.writeTextElement(u"cursor"_s, QString::number(elementCursor()));
5153 writer.writeTextElement(u"cursorShape"_s, elementCursorShape());
5157 writer.writeTextElement(u"enum"_s, elementEnum());
5161 if (m_font !=
nullptr)
5162 m_font->write(writer, u"font"_s);
5166 if (m_iconSet !=
nullptr)
5167 m_iconSet->write(writer, u"iconset"_s);
5171 if (m_pixmap !=
nullptr)
5172 m_pixmap->write(writer, u"pixmap"_s);
5176 if (m_palette !=
nullptr)
5177 m_palette->write(writer, u"palette"_s);
5181 if (m_point !=
nullptr)
5182 m_point->write(writer, u"point"_s);
5186 if (m_rect !=
nullptr)
5187 m_rect->write(writer, u"rect"_s);
5191 writer.writeTextElement(u"set"_s, elementSet());
5195 if (m_locale !=
nullptr)
5196 m_locale->write(writer, u"locale"_s);
5200 if (m_sizePolicy !=
nullptr)
5201 m_sizePolicy->write(writer, u"sizepolicy"_s);
5205 if (m_size !=
nullptr)
5206 m_size->write(writer, u"size"_s);
5210 if (m_string !=
nullptr)
5211 m_string->write(writer, u"string"_s);
5215 if (m_stringList !=
nullptr)
5216 m_stringList->write(writer, u"stringlist"_s);
5220 writer.writeTextElement(u"number"_s, QString::number(elementNumber()));
5224 writer.writeTextElement(u"float"_s, QString::number(elementFloat(),
'f', 8));
5228 writer.writeTextElement(u"double"_s, QString::number(elementDouble(),
'f', 15));
5232 if (m_date !=
nullptr)
5233 m_date->write(writer, u"date"_s);
5237 if (m_time !=
nullptr)
5238 m_time->write(writer, u"time"_s);
5242 if (m_dateTime !=
nullptr)
5243 m_dateTime->write(writer, u"datetime"_s);
5247 if (m_pointF !=
nullptr)
5248 m_pointF->write(writer, u"pointf"_s);
5252 if (m_rectF !=
nullptr)
5253 m_rectF->write(writer, u"rectf"_s);
5257 if (m_sizeF !=
nullptr)
5258 m_sizeF->write(writer, u"sizef"_s);
5262 writer.writeTextElement(u"longLong"_s, QString::number(elementLongLong()));
5266 if (m_char !=
nullptr)
5267 m_char->write(writer, u"char"_s);
5271 if (m_url !=
nullptr)
5272 m_url->write(writer, u"url"_s);
5276 writer.writeTextElement(u"UInt"_s, QString::number(elementUInt()));
5280 writer.writeTextElement(u"uLongLong"_s, QString::number(elementULongLong()));
5284 if (m_brush !=
nullptr)
5285 m_brush->write(writer, u"brush"_s);
5291 writer.writeEndElement();
5294void DomProperty::setElementBool(
const QString &a)
5301DomColor *DomProperty::takeElementColor()
5303 DomColor *a = m_color;
5308void DomProperty::setElementColor(DomColor *a)
5315void DomProperty::setElementCstring(
const QString &a)
5322void DomProperty::setElementCursor(
int a)
5329void DomProperty::setElementCursorShape(
const QString &a)
5332 m_kind = CursorShape;
5336void DomProperty::setElementEnum(
const QString &a)
5343DomFont *DomProperty::takeElementFont()
5345 DomFont *a = m_font;
5350void DomProperty::setElementFont(DomFont *a)
5357DomResourceIcon *DomProperty::takeElementIconSet()
5359 DomResourceIcon *a = m_iconSet;
5360 m_iconSet =
nullptr;
5364void DomProperty::setElementIconSet(DomResourceIcon *a)
5371DomResourcePixmap *DomProperty::takeElementPixmap()
5373 DomResourcePixmap *a = m_pixmap;
5378void DomProperty::setElementPixmap(DomResourcePixmap *a)
5385DomPalette *DomProperty::takeElementPalette()
5387 DomPalette *a = m_palette;
5388 m_palette =
nullptr;
5392void DomProperty::setElementPalette(DomPalette *a)
5399DomPoint *DomProperty::takeElementPoint()
5401 DomPoint *a = m_point;
5406void DomProperty::setElementPoint(DomPoint *a)
5413DomRect *DomProperty::takeElementRect()
5415 DomRect *a = m_rect;
5420void DomProperty::setElementRect(DomRect *a)
5427void DomProperty::setElementSet(
const QString &a)
5434DomLocale *DomProperty::takeElementLocale()
5436 DomLocale *a = m_locale;
5441void DomProperty::setElementLocale(DomLocale *a)
5448DomSizePolicy *DomProperty::takeElementSizePolicy()
5450 DomSizePolicy *a = m_sizePolicy;
5451 m_sizePolicy =
nullptr;
5455void DomProperty::setElementSizePolicy(DomSizePolicy *a)
5458 m_kind = SizePolicy;
5462DomSize *DomProperty::takeElementSize()
5464 DomSize *a = m_size;
5469void DomProperty::setElementSize(DomSize *a)
5476DomString *DomProperty::takeElementString()
5478 DomString *a = m_string;
5483void DomProperty::setElementString(DomString *a)
5490DomStringList *DomProperty::takeElementStringList()
5492 DomStringList *a = m_stringList;
5493 m_stringList =
nullptr;
5497void DomProperty::setElementStringList(DomStringList *a)
5500 m_kind = StringList;
5504void DomProperty::setElementNumber(
int a)
5511void DomProperty::setElementFloat(
float a)
5518void DomProperty::setElementDouble(
double a)
5525DomDate *DomProperty::takeElementDate()
5527 DomDate *a = m_date;
5532void DomProperty::setElementDate(DomDate *a)
5539DomTime *DomProperty::takeElementTime()
5541 DomTime *a = m_time;
5546void DomProperty::setElementTime(DomTime *a)
5553DomDateTime *DomProperty::takeElementDateTime()
5555 DomDateTime *a = m_dateTime;
5556 m_dateTime =
nullptr;
5560void DomProperty::setElementDateTime(DomDateTime *a)
5567DomPointF *DomProperty::takeElementPointF()
5569 DomPointF *a = m_pointF;
5574void DomProperty::setElementPointF(DomPointF *a)
5581DomRectF *DomProperty::takeElementRectF()
5583 DomRectF *a = m_rectF;
5588void DomProperty::setElementRectF(DomRectF *a)
5595DomSizeF *DomProperty::takeElementSizeF()
5597 DomSizeF *a = m_sizeF;
5602void DomProperty::setElementSizeF(DomSizeF *a)
5609void DomProperty::setElementLongLong(qlonglong a)
5616DomChar *DomProperty::takeElementChar()
5618 DomChar *a = m_char;
5623void DomProperty::setElementChar(DomChar *a)
5630DomUrl *DomProperty::takeElementUrl()
5637void DomProperty::setElementUrl(DomUrl *a)
5644void DomProperty::setElementUInt(uint a)
5651void DomProperty::setElementULongLong(qulonglong a)
5658DomBrush *DomProperty::takeElementBrush()
5660 DomBrush *a = m_brush;
5665void DomProperty::setElementBrush(DomBrush *a)
5672DomConnections::~DomConnections()
5674 qDeleteAll(m_connection);
5675 m_connection.clear();
5678void DomConnections::read(QXmlStreamReader &reader)
5680 while (!reader.hasError()) {
5681 switch (reader.readNext()) {
5682 case QXmlStreamReader::StartElement : {
5683 const auto tag = reader.name();
5684 if (!tag.compare(u"connection"_s, Qt::CaseInsensitive)) {
5685 auto *v =
new DomConnection();
5687 m_connection.append(v);
5690 reader.raiseError(
"Unexpected element "_L1 + tag);
5693 case QXmlStreamReader::EndElement :
5701void DomConnections::write(QXmlStreamWriter &writer,
const QString &tagName)
const
5703 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"connections") : tagName.toLower());
5705 for (DomConnection *v : m_connection)
5706 v->write(writer, u"connection"_s);
5708 writer.writeEndElement();
5711void DomConnections::setElementConnection(
const QList<DomConnection *> &a)
5713 m_children |= Connection;
5717DomConnection::~DomConnection()
5722void DomConnection::read(QXmlStreamReader &reader)
5724 while (!reader.hasError()) {
5725 switch (reader.readNext()) {
5726 case QXmlStreamReader::StartElement : {
5727 const auto tag = reader.name();
5728 if (!tag.compare(u"sender"_s, Qt::CaseInsensitive)) {
5729 setElementSender(reader.readElementText());
5732 if (!tag.compare(u"signal"_s, Qt::CaseInsensitive)) {
5733 setElementSignal(reader.readElementText());
5736 if (!tag.compare(u"receiver"_s, Qt::CaseInsensitive)) {
5737 setElementReceiver(reader.readElementText());
5740 if (!tag.compare(u"slot"_s, Qt::CaseInsensitive)) {
5741 setElementSlot(reader.readElementText());
5744 if (!tag.compare(u"hints"_s, Qt::CaseInsensitive)) {
5745 auto *v =
new DomConnectionHints();
5750 reader.raiseError(
"Unexpected element "_L1 + tag);
5753 case QXmlStreamReader::EndElement :
5761void DomConnection::write(QXmlStreamWriter &writer,
const QString &tagName)
const
5763 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"connection") : tagName.toLower());
5765 if (m_children & Sender)
5766 writer.writeTextElement(u"sender"_s, m_sender);
5768 if (m_children & Signal)
5769 writer.writeTextElement(u"signal"_s, m_signal);
5771 if (m_children & Receiver)
5772 writer.writeTextElement(u"receiver"_s, m_receiver);
5774 if (m_children & Slot)
5775 writer.writeTextElement(u"slot"_s, m_slot);
5777 if (m_children & Hints)
5778 m_hints->write(writer, u"hints"_s);
5780 writer.writeEndElement();
5783void DomConnection::setElementSender(
const QString &a)
5785 m_children |= Sender;
5789void DomConnection::setElementSignal(
const QString &a)
5791 m_children |= Signal;
5795void DomConnection::setElementReceiver(
const QString &a)
5797 m_children |= Receiver;
5801void DomConnection::setElementSlot(
const QString &a)
5807DomConnectionHints *DomConnection::takeElementHints()
5809 DomConnectionHints *a = m_hints;
5811 m_children ^= Hints;
5815void DomConnection::setElementHints(DomConnectionHints *a)
5818 m_children |= Hints;
5822void DomConnection::clearElementSender()
5824 m_children &= ~Sender;
5827void DomConnection::clearElementSignal()
5829 m_children &= ~Signal;
5832void DomConnection::clearElementReceiver()
5834 m_children &= ~Receiver;
5837void DomConnection::clearElementSlot()
5839 m_children &= ~Slot;
5842void DomConnection::clearElementHints()
5846 m_children &= ~Hints;
5849DomConnectionHints::~DomConnectionHints()
5855void DomConnectionHints::read(QXmlStreamReader &reader)
5857 while (!reader.hasError()) {
5858 switch (reader.readNext()) {
5859 case QXmlStreamReader::StartElement : {
5860 const auto tag = reader.name();
5861 if (!tag.compare(u"hint"_s, Qt::CaseInsensitive)) {
5862 auto *v =
new DomConnectionHint();
5867 reader.raiseError(
"Unexpected element "_L1 + tag);
5870 case QXmlStreamReader::EndElement :
5878void DomConnectionHints::write(QXmlStreamWriter &writer,
const QString &tagName)
const
5880 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"connectionhints") : tagName.toLower());
5882 for (DomConnectionHint *v : m_hint)
5883 v->write(writer, u"hint"_s);
5885 writer.writeEndElement();
5888void DomConnectionHints::setElementHint(
const QList<DomConnectionHint *> &a)
5894DomConnectionHint::~DomConnectionHint() =
default;
5896void DomConnectionHint::read(QXmlStreamReader &reader)
5898 const QXmlStreamAttributes &attributes = reader.attributes();
5899 for (
const QXmlStreamAttribute &attribute : attributes) {
5900 const auto name = attribute.name();
5901 if (name == u"type"_s) {
5902 setAttributeType(attribute.value().toString());
5905 reader.raiseError(
"Unexpected attribute "_L1 + name);
5908 while (!reader.hasError()) {
5909 switch (reader.readNext()) {
5910 case QXmlStreamReader::StartElement : {
5911 const auto tag = reader.name();
5912 if (!tag.compare(u"x"_s, Qt::CaseInsensitive)) {
5913 setElementX(reader.readElementText().toInt());
5916 if (!tag.compare(u"y"_s, Qt::CaseInsensitive)) {
5917 setElementY(reader.readElementText().toInt());
5920 reader.raiseError(
"Unexpected element "_L1 + tag);
5923 case QXmlStreamReader::EndElement :
5931void DomConnectionHint::write(QXmlStreamWriter &writer,
const QString &tagName)
const
5933 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"connectionhint") : tagName.toLower());
5935 if (hasAttributeType())
5936 writer.writeAttribute(u"type"_s, attributeType());
5939 writer.writeTextElement(u"x"_s, QString::number(m_x));
5942 writer.writeTextElement(u"y"_s, QString::number(m_y));
5944 writer.writeEndElement();
5947void DomConnectionHint::setElementX(
int a)
5953void DomConnectionHint::setElementY(
int a)
5959void DomConnectionHint::clearElementX()
5964void DomConnectionHint::clearElementY()
5969DomDesignerData::~DomDesignerData()
5971 qDeleteAll(m_property);
5975void DomDesignerData::read(QXmlStreamReader &reader)
5977 while (!reader.hasError()) {
5978 switch (reader.readNext()) {
5979 case QXmlStreamReader::StartElement : {
5980 const auto tag = reader.name();
5981 if (!tag.compare(u"property"_s, Qt::CaseInsensitive)) {
5982 auto *v =
new DomProperty();
5984 m_property.append(v);
5987 reader.raiseError(
"Unexpected element "_L1 + tag);
5990 case QXmlStreamReader::EndElement :
5998void DomDesignerData::write(QXmlStreamWriter &writer,
const QString &tagName)
const
6000 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"designerdata") : tagName.toLower());
6002 for (DomProperty *v : m_property)
6003 v->write(writer, u"property"_s);
6005 writer.writeEndElement();
6008void DomDesignerData::setElementProperty(
const QList<DomProperty *> &a)
6010 m_children |= Property;
6014DomSlots::~DomSlots()
6020void DomSlots::read(QXmlStreamReader &reader)
6022 while (!reader.hasError()) {
6023 switch (reader.readNext()) {
6024 case QXmlStreamReader::StartElement : {
6025 const auto tag = reader.name();
6026 if (!tag.compare(u"signal"_s, Qt::CaseInsensitive)) {
6027 m_signal.append(reader.readElementText());
6030 if (!tag.compare(u"slot"_s, Qt::CaseInsensitive)) {
6031 m_slot.append(reader.readElementText());
6034 reader.raiseError(
"Unexpected element "_L1 + tag);
6037 case QXmlStreamReader::EndElement :
6045void DomSlots::write(QXmlStreamWriter &writer,
const QString &tagName)
const
6047 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"slots") : tagName.toLower());
6049 for (
const QString &v : m_signal)
6050 writer.writeTextElement(u"signal"_s, v);
6052 for (
const QString &v : m_slot)
6053 writer.writeTextElement(u"slot"_s, v);
6055 writer.writeEndElement();
6058void DomSlots::setElementSignal(
const QStringList &a)
6060 m_children |= Signal;
6064void DomSlots::setElementSlot(
const QStringList &a)
6070DomPropertySpecifications::~DomPropertySpecifications()
6072 qDeleteAll(m_tooltip);
6074 qDeleteAll(m_stringpropertyspecification);
6075 m_stringpropertyspecification.clear();
6078void DomPropertySpecifications::read(QXmlStreamReader &reader)
6080 while (!reader.hasError()) {
6081 switch (reader.readNext()) {
6082 case QXmlStreamReader::StartElement : {
6083 const auto tag = reader.name();
6084 if (!tag.compare(u"tooltip"_s, Qt::CaseInsensitive)) {
6085 auto *v =
new DomPropertyToolTip();
6087 m_tooltip.append(v);
6090 if (!tag.compare(u"stringpropertyspecification"_s, Qt::CaseInsensitive)) {
6091 auto *v =
new DomStringPropertySpecification();
6093 m_stringpropertyspecification.append(v);
6096 reader.raiseError(
"Unexpected element "_L1 + tag);
6099 case QXmlStreamReader::EndElement :
6107void DomPropertySpecifications::write(QXmlStreamWriter &writer,
const QString &tagName)
const
6109 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"propertyspecifications") : tagName.toLower());
6111 for (DomPropertyToolTip *v : m_tooltip)
6112 v->write(writer, u"tooltip"_s);
6114 for (DomStringPropertySpecification *v : m_stringpropertyspecification)
6115 v->write(writer, u"stringpropertyspecification"_s);
6117 writer.writeEndElement();
6120void DomPropertySpecifications::setElementTooltip(
const QList<DomPropertyToolTip *> &a)
6122 m_children |= Tooltip;
6126void DomPropertySpecifications::setElementStringpropertyspecification(
const QList<DomStringPropertySpecification *> &a)
6128 m_children |= Stringpropertyspecification;
6129 m_stringpropertyspecification = a;
6132DomPropertyToolTip::~DomPropertyToolTip() =
default;
6134void DomPropertyToolTip::read(QXmlStreamReader &reader)
6136 const QXmlStreamAttributes &attributes = reader.attributes();
6137 for (
const QXmlStreamAttribute &attribute : attributes) {
6138 const auto name = attribute.name();
6139 if (name == u"name"_s) {
6140 setAttributeName(attribute.value().toString());
6143 reader.raiseError(
"Unexpected attribute "_L1 + name);
6146 while (!reader.hasError()) {
6147 switch (reader.readNext()) {
6148 case QXmlStreamReader::StartElement : {
6149 const auto tag = reader.name();
6150 reader.raiseError(
"Unexpected element "_L1 + tag);
6153 case QXmlStreamReader::EndElement :
6161void DomPropertyToolTip::write(QXmlStreamWriter &writer,
const QString &tagName)
const
6163 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"propertytooltip") : tagName.toLower());
6165 if (hasAttributeName())
6166 writer.writeAttribute(u"name"_s, attributeName());
6168 writer.writeEndElement();
6171DomStringPropertySpecification::~DomStringPropertySpecification() =
default;
6173void DomStringPropertySpecification::read(QXmlStreamReader &reader)
6175 const QXmlStreamAttributes &attributes = reader.attributes();
6176 for (
const QXmlStreamAttribute &attribute : attributes) {
6177 const auto name = attribute.name();
6178 if (name == u"name"_s) {
6179 setAttributeName(attribute.value().toString());
6182 if (name == u"type"_s) {
6183 setAttributeType(attribute.value().toString());
6186 if (name == u"notr"_s) {
6187 setAttributeNotr(attribute.value().toString());
6190 reader.raiseError(
"Unexpected attribute "_L1 + name);
6193 while (!reader.hasError()) {
6194 switch (reader.readNext()) {
6195 case QXmlStreamReader::StartElement : {
6196 const auto tag = reader.name();
6197 reader.raiseError(
"Unexpected element "_L1 + tag);
6200 case QXmlStreamReader::EndElement :
6208void DomStringPropertySpecification::write(QXmlStreamWriter &writer,
const QString &tagName)
const
6210 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"stringpropertyspecification") : tagName.toLower());
6212 if (hasAttributeName())
6213 writer.writeAttribute(u"name"_s, attributeName());
6215 if (hasAttributeType())
6216 writer.writeAttribute(u"type"_s, attributeType());
6218 if (hasAttributeNotr())
6219 writer.writeAttribute(u"notr"_s, attributeNotr());
6221 writer.writeEndElement();
#define QStringLiteral(str)