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"connectslotsbyname"_s) {
58 setAttributeConnectslotsbyname(attribute.value() == u"true"_s);
61 if (name == u"stdsetdef"_s) {
62 setAttributeStdsetdef(attribute.value().toInt());
65 if (name == u"stdSetDef"_s) {
66 setAttributeStdSetDef(attribute.value().toInt());
69 reader.raiseError(
"Unexpected attribute "_L1 + name);
72 while (!reader.hasError()) {
73 switch (reader.readNext()) {
74 case QXmlStreamReader::StartElement : {
75 const auto tag = reader.name();
76 if (!tag.compare(u"author"_s, Qt::CaseInsensitive)) {
77 setElementAuthor(reader.readElementText());
80 if (!tag.compare(u"comment"_s, Qt::CaseInsensitive)) {
81 setElementComment(reader.readElementText());
84 if (!tag.compare(u"exportmacro"_s, Qt::CaseInsensitive)) {
85 setElementExportMacro(reader.readElementText());
88 if (!tag.compare(u"class"_s, Qt::CaseInsensitive)) {
89 setElementClass(reader.readElementText());
92 if (!tag.compare(u"widget"_s, Qt::CaseInsensitive)) {
93 auto *v =
new DomWidget();
98 if (!tag.compare(u"layoutdefault"_s, Qt::CaseInsensitive)) {
99 auto *v =
new DomLayoutDefault();
101 setElementLayoutDefault(v);
104 if (!tag.compare(u"layoutfunction"_s, Qt::CaseInsensitive)) {
105 auto *v =
new DomLayoutFunction();
107 setElementLayoutFunction(v);
110 if (!tag.compare(u"pixmapfunction"_s, Qt::CaseInsensitive)) {
111 setElementPixmapFunction(reader.readElementText());
114 if (!tag.compare(u"customwidgets"_s, Qt::CaseInsensitive)) {
115 auto *v =
new DomCustomWidgets();
117 setElementCustomWidgets(v);
120 if (!tag.compare(u"tabstops"_s, Qt::CaseInsensitive)) {
121 auto *v =
new DomTabStops();
123 setElementTabStops(v);
126 if (!tag.compare(u"images"_s, Qt::CaseInsensitive)) {
127 qWarning(
"Omitting deprecated element <images>.");
128 reader.skipCurrentElement();
131 if (!tag.compare(u"includes"_s, Qt::CaseInsensitive)) {
132 auto *v =
new DomIncludes();
134 setElementIncludes(v);
137 if (!tag.compare(u"resources"_s, Qt::CaseInsensitive)) {
138 auto *v =
new DomResources();
140 setElementResources(v);
143 if (!tag.compare(u"connections"_s, Qt::CaseInsensitive)) {
144 auto *v =
new DomConnections();
146 setElementConnections(v);
149 if (!tag.compare(u"designerdata"_s, Qt::CaseInsensitive)) {
150 auto *v =
new DomDesignerData();
152 setElementDesignerdata(v);
155 if (!tag.compare(u"slots"_s, Qt::CaseInsensitive)) {
156 auto *v =
new DomSlots();
161 if (!tag.compare(u"buttongroups"_s, Qt::CaseInsensitive)) {
162 auto *v =
new DomButtonGroups();
164 setElementButtonGroups(v);
167 reader.raiseError(
"Unexpected element "_L1 + tag);
170 case QXmlStreamReader::EndElement :
178void DomUI::write(QXmlStreamWriter &writer,
const QString &tagName)
const
180 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral(
"ui") : tagName.toLower());
182 if (hasAttributeVersion())
183 writer.writeAttribute(u"version"_s, attributeVersion());
185 if (hasAttributeLanguage())
186 writer.writeAttribute(u"language"_s, attributeLanguage());
188 if (hasAttributeDisplayname())
189 writer.writeAttribute(u"displayname"_s, attributeDisplayname());
191 if (hasAttributeIdbasedtr())
192 writer.writeAttribute(u"idbasedtr"_s, (attributeIdbasedtr() ? u"true"_s : u"false"_s));
194 if (hasAttributeConnectslotsbyname())
195 writer.writeAttribute(u"connectslotsbyname"_s, (attributeConnectslotsbyname() ? u"true"_s : u"false"_s));
197 if (hasAttributeStdsetdef())
198 writer.writeAttribute(u"stdsetdef"_s, QString::number(attributeStdsetdef()));
200 if (hasAttributeStdSetDef())
201 writer.writeAttribute(u"stdsetdef"_s, QString::number(attributeStdSetDef()));
203 if (m_children & Author)
204 writer.writeTextElement(u"author"_s, m_author);
206 if (m_children & Comment)
207 writer.writeTextElement(u"comment"_s, m_comment);
209 if (m_children & ExportMacro)
210 writer.writeTextElement(u"exportmacro"_s, m_exportMacro);
212 if (m_children & Class)
213 writer.writeTextElement(u"class"_s, m_class);
215 if (m_children & Widget)
216 m_widget->write(writer, u"widget"_s);
218 if (m_children & LayoutDefault)
219 m_layoutDefault->write(writer, u"layoutdefault"_s);
221 if (m_children & LayoutFunction)
222 m_layoutFunction->write(writer, u"layoutfunction"_s);
224 if (m_children & PixmapFunction)
225 writer.writeTextElement(u"pixmapfunction"_s, m_pixmapFunction);
227 if (m_children & CustomWidgets)
228 m_customWidgets->write(writer, u"customwidgets"_s);
230 if (m_children & TabStops)
231 m_tabStops->write(writer, u"tabstops"_s);
233 if (m_children & Includes)
234 m_includes->write(writer, u"includes"_s);
236 if (m_children & Resources)
237 m_resources->write(writer, u"resources"_s);
239 if (m_children & Connections)
240 m_connections->write(writer, u"connections"_s);
242 if (m_children & Designerdata)
243 m_designerdata->write(writer, u"designerdata"_s);
245 if (m_children & Slots)
246 m_slots->write(writer, u"slots"_s);
248 if (m_children & ButtonGroups)
249 m_buttonGroups->write(writer, u"buttongroups"_s);
251 writer.writeEndElement();
254void DomUI::setElementAuthor(
const QString &a)
256 m_children |= Author;
260void DomUI::setElementComment(
const QString &a)
262 m_children |= Comment;
266void DomUI::setElementExportMacro(
const QString &a)
268 m_children |= ExportMacro;
272void DomUI::setElementClass(
const QString &a)
278DomWidget *DomUI::takeElementWidget()
280 DomWidget *a = m_widget;
282 m_children ^= Widget;
286void DomUI::setElementWidget(DomWidget *a)
289 m_children |= Widget;
293DomLayoutDefault *DomUI::takeElementLayoutDefault()
295 DomLayoutDefault *a = m_layoutDefault;
296 m_layoutDefault =
nullptr;
297 m_children ^= LayoutDefault;
301void DomUI::setElementLayoutDefault(DomLayoutDefault *a)
303 delete m_layoutDefault;
304 m_children |= LayoutDefault;
308DomLayoutFunction *DomUI::takeElementLayoutFunction()
310 DomLayoutFunction *a = m_layoutFunction;
311 m_layoutFunction =
nullptr;
312 m_children ^= LayoutFunction;
316void DomUI::setElementLayoutFunction(DomLayoutFunction *a)
318 delete m_layoutFunction;
319 m_children |= LayoutFunction;
320 m_layoutFunction = a;
323void DomUI::setElementPixmapFunction(
const QString &a)
325 m_children |= PixmapFunction;
326 m_pixmapFunction = a;
329DomCustomWidgets *DomUI::takeElementCustomWidgets()
331 DomCustomWidgets *a = m_customWidgets;
332 m_customWidgets =
nullptr;
333 m_children ^= CustomWidgets;
337void DomUI::setElementCustomWidgets(DomCustomWidgets *a)
339 delete m_customWidgets;
340 m_children |= CustomWidgets;
344DomTabStops *DomUI::takeElementTabStops()
346 DomTabStops *a = m_tabStops;
347 m_tabStops =
nullptr;
348 m_children ^= TabStops;
352void DomUI::setElementTabStops(DomTabStops *a)
355 m_children |= TabStops;
359DomIncludes *DomUI::takeElementIncludes()
361 DomIncludes *a = m_includes;
362 m_includes =
nullptr;
363 m_children ^= Includes;
367void DomUI::setElementIncludes(DomIncludes *a)
370 m_children |= Includes;
374DomResources *DomUI::takeElementResources()
376 DomResources *a = m_resources;
377 m_resources =
nullptr;
378 m_children ^= Resources;
382void DomUI::setElementResources(DomResources *a)
385 m_children |= Resources;
389DomConnections *DomUI::takeElementConnections()
391 DomConnections *a = m_connections;
392 m_connections =
nullptr;
393 m_children ^= Connections;
397void DomUI::setElementConnections(DomConnections *a)
399 delete m_connections;
400 m_children |= Connections;
404DomDesignerData *DomUI::takeElementDesignerdata()
406 DomDesignerData *a = m_designerdata;
407 m_designerdata =
nullptr;
408 m_children ^= Designerdata;
412void DomUI::setElementDesignerdata(DomDesignerData *a)
414 delete m_designerdata;
415 m_children |= Designerdata;
419DomSlots *DomUI::takeElementSlots()
421 DomSlots *a = m_slots;
427void DomUI::setElementSlots(DomSlots *a)
434DomButtonGroups *DomUI::takeElementButtonGroups()
436 DomButtonGroups *a = m_buttonGroups;
437 m_buttonGroups =
nullptr;
438 m_children ^= ButtonGroups;
442void DomUI::setElementButtonGroups(DomButtonGroups *a)
444 delete m_buttonGroups;
445 m_children |= ButtonGroups;
449void DomUI::clearElementAuthor()
451 m_children &= ~Author;
454void DomUI::clearElementComment()
456 m_children &= ~Comment;
459void DomUI::clearElementExportMacro()
461 m_children &= ~ExportMacro;
464void DomUI::clearElementClass()
466 m_children &= ~Class;
469void DomUI::clearElementWidget()
473 m_children &= ~Widget;
476void DomUI::clearElementLayoutDefault()
478 delete m_layoutDefault;
479 m_layoutDefault =
nullptr;
480 m_children &= ~LayoutDefault;
483void DomUI::clearElementLayoutFunction()
485 delete m_layoutFunction;
486 m_layoutFunction =
nullptr;
487 m_children &= ~LayoutFunction;
490void DomUI::clearElementPixmapFunction()
492 m_children &= ~PixmapFunction;
495void DomUI::clearElementCustomWidgets()
497 delete m_customWidgets;
498 m_customWidgets =
nullptr;
499 m_children &= ~CustomWidgets;
502void DomUI::clearElementTabStops()
505 m_tabStops =
nullptr;
506 m_children &= ~TabStops;
509void DomUI::clearElementIncludes()
512 m_includes =
nullptr;
513 m_children &= ~Includes;
516void DomUI::clearElementResources()
519 m_resources =
nullptr;
520 m_children &= ~Resources;
523void DomUI::clearElementConnections()
525 delete m_connections;
526 m_connections =
nullptr;
527 m_children &= ~Connections;
530void DomUI::clearElementDesignerdata()
532 delete m_designerdata;
533 m_designerdata =
nullptr;
534 m_children &= ~Designerdata;
537void DomUI::clearElementSlots()
541 m_children &= ~Slots;
544void DomUI::clearElementButtonGroups()
546 delete m_buttonGroups;
547 m_buttonGroups =
nullptr;
548 m_children &= ~ButtonGroups;
551DomIncludes::~DomIncludes()
553 qDeleteAll(m_include);
557void DomIncludes::read(QXmlStreamReader &reader)
559 while (!reader.hasError()) {
560 switch (reader.readNext()) {
561 case QXmlStreamReader::StartElement : {
562 const auto tag = reader.name();
563 if (!tag.compare(u"include"_s, Qt::CaseInsensitive)) {
564 auto *v =
new DomInclude();
569 reader.raiseError(
"Unexpected element "_L1 + tag);
572 case QXmlStreamReader::EndElement :
580void DomIncludes::write(QXmlStreamWriter &writer,
const QString &tagName)
const
582 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral(
"includes") : tagName.toLower());
584 for (DomInclude *v : m_include)
585 v->write(writer, u"include"_s);
587 writer.writeEndElement();
590void DomIncludes::setElementInclude(
const QList<DomInclude *> &a)
592 m_children |= Include;
596DomInclude::~DomInclude() =
default;
598void DomInclude::read(QXmlStreamReader &reader)
600 const QXmlStreamAttributes &attributes = reader.attributes();
601 for (
const QXmlStreamAttribute &attribute : attributes) {
602 const auto name = attribute.name();
603 if (name == u"location"_s) {
604 setAttributeLocation(attribute.value().toString());
607 if (name == u"impldecl"_s) {
608 setAttributeImpldecl(attribute.value().toString());
611 reader.raiseError(
"Unexpected attribute "_L1 + name);
614 while (!reader.hasError()) {
615 switch (reader.readNext()) {
616 case QXmlStreamReader::StartElement : {
617 const auto tag = reader.name();
618 reader.raiseError(
"Unexpected element "_L1 + tag);
621 case QXmlStreamReader::EndElement :
623 case QXmlStreamReader::Characters :
624 if (!reader.isWhitespace())
625 m_text.append(reader.text().toString());
633void DomInclude::write(QXmlStreamWriter &writer,
const QString &tagName)
const
635 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral(
"include") : tagName.toLower());
637 if (hasAttributeLocation())
638 writer.writeAttribute(u"location"_s, attributeLocation());
640 if (hasAttributeImpldecl())
641 writer.writeAttribute(u"impldecl"_s, attributeImpldecl());
643 if (!m_text.isEmpty())
644 writer.writeCharacters(m_text);
646 writer.writeEndElement();
649DomResources::~DomResources()
651 qDeleteAll(m_include);
655void DomResources::read(QXmlStreamReader &reader)
657 const QXmlStreamAttributes &attributes = reader.attributes();
658 for (
const QXmlStreamAttribute &attribute : attributes) {
659 const auto name = attribute.name();
660 if (name == u"name"_s) {
661 setAttributeName(attribute.value().toString());
664 reader.raiseError(
"Unexpected attribute "_L1 + name);
667 while (!reader.hasError()) {
668 switch (reader.readNext()) {
669 case QXmlStreamReader::StartElement : {
670 const auto tag = reader.name();
671 if (!tag.compare(u"include"_s, Qt::CaseInsensitive)) {
672 auto *v =
new DomResource();
677 reader.raiseError(
"Unexpected element "_L1 + tag);
680 case QXmlStreamReader::EndElement :
688void DomResources::write(QXmlStreamWriter &writer,
const QString &tagName)
const
690 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral(
"resources") : tagName.toLower());
692 if (hasAttributeName())
693 writer.writeAttribute(u"name"_s, attributeName());
695 for (DomResource *v : m_include)
696 v->write(writer, u"include"_s);
698 writer.writeEndElement();
701void DomResources::setElementInclude(
const QList<DomResource *> &a)
703 m_children |= Include;
707DomResource::~DomResource() =
default;
709void DomResource::read(QXmlStreamReader &reader)
711 const QXmlStreamAttributes &attributes = reader.attributes();
712 for (
const QXmlStreamAttribute &attribute : attributes) {
713 const auto name = attribute.name();
714 if (name == u"location"_s) {
715 setAttributeLocation(attribute.value().toString());
718 reader.raiseError(
"Unexpected attribute "_L1 + name);
721 while (!reader.hasError()) {
722 switch (reader.readNext()) {
723 case QXmlStreamReader::StartElement : {
724 const auto tag = reader.name();
725 reader.raiseError(
"Unexpected element "_L1 + tag);
728 case QXmlStreamReader::EndElement :
736void DomResource::write(QXmlStreamWriter &writer,
const QString &tagName)
const
738 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral(
"resource") : tagName.toLower());
740 if (hasAttributeLocation())
741 writer.writeAttribute(u"location"_s, attributeLocation());
743 writer.writeEndElement();
746DomActionGroup::~DomActionGroup()
748 qDeleteAll(m_action);
750 qDeleteAll(m_actionGroup);
751 m_actionGroup.clear();
752 qDeleteAll(m_property);
754 qDeleteAll(m_attribute);
758void DomActionGroup::read(QXmlStreamReader &reader)
760 const QXmlStreamAttributes &attributes = reader.attributes();
761 for (
const QXmlStreamAttribute &attribute : attributes) {
762 const auto name = attribute.name();
763 if (name == u"name"_s) {
764 setAttributeName(attribute.value().toString());
767 reader.raiseError(
"Unexpected attribute "_L1 + name);
770 while (!reader.hasError()) {
771 switch (reader.readNext()) {
772 case QXmlStreamReader::StartElement : {
773 const auto tag = reader.name();
774 if (!tag.compare(u"action"_s, Qt::CaseInsensitive)) {
775 auto *v =
new DomAction();
780 if (!tag.compare(u"actiongroup"_s, Qt::CaseInsensitive)) {
781 auto *v =
new DomActionGroup();
783 m_actionGroup.append(v);
786 if (!tag.compare(u"property"_s, Qt::CaseInsensitive)) {
787 auto *v =
new DomProperty();
789 m_property.append(v);
792 if (!tag.compare(u"attribute"_s, Qt::CaseInsensitive)) {
793 auto *v =
new DomProperty();
795 m_attribute.append(v);
798 reader.raiseError(
"Unexpected element "_L1 + tag);
801 case QXmlStreamReader::EndElement :
809void DomActionGroup::write(QXmlStreamWriter &writer,
const QString &tagName)
const
811 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral(
"actiongroup") : tagName.toLower());
813 if (hasAttributeName())
814 writer.writeAttribute(u"name"_s, attributeName());
816 for (DomAction *v : m_action)
817 v->write(writer, u"action"_s);
819 for (DomActionGroup *v : m_actionGroup)
820 v->write(writer, u"actiongroup"_s);
822 for (DomProperty *v : m_property)
823 v->write(writer, u"property"_s);
825 for (DomProperty *v : m_attribute)
826 v->write(writer, u"attribute"_s);
828 writer.writeEndElement();
831void DomActionGroup::setElementAction(
const QList<DomAction *> &a)
833 m_children |= Action;
837void DomActionGroup::setElementActionGroup(
const QList<DomActionGroup *> &a)
839 m_children |= ActionGroup;
843void DomActionGroup::setElementProperty(
const QList<DomProperty *> &a)
845 m_children |= Property;
849void DomActionGroup::setElementAttribute(
const QList<DomProperty *> &a)
851 m_children |= Attribute;
855DomAction::~DomAction()
857 qDeleteAll(m_property);
859 qDeleteAll(m_attribute);
863void DomAction::read(QXmlStreamReader &reader)
865 const QXmlStreamAttributes &attributes = reader.attributes();
866 for (
const QXmlStreamAttribute &attribute : attributes) {
867 const auto name = attribute.name();
868 if (name == u"name"_s) {
869 setAttributeName(attribute.value().toString());
872 if (name == u"menu"_s) {
873 setAttributeMenu(attribute.value().toString());
876 reader.raiseError(
"Unexpected attribute "_L1 + name);
879 while (!reader.hasError()) {
880 switch (reader.readNext()) {
881 case QXmlStreamReader::StartElement : {
882 const auto tag = reader.name();
883 if (!tag.compare(u"property"_s, Qt::CaseInsensitive)) {
884 auto *v =
new DomProperty();
886 m_property.append(v);
889 if (!tag.compare(u"attribute"_s, Qt::CaseInsensitive)) {
890 auto *v =
new DomProperty();
892 m_attribute.append(v);
895 reader.raiseError(
"Unexpected element "_L1 + tag);
898 case QXmlStreamReader::EndElement :
906void DomAction::write(QXmlStreamWriter &writer,
const QString &tagName)
const
908 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral(
"action") : tagName.toLower());
910 if (hasAttributeName())
911 writer.writeAttribute(u"name"_s, attributeName());
913 if (hasAttributeMenu())
914 writer.writeAttribute(u"menu"_s, attributeMenu());
916 for (DomProperty *v : m_property)
917 v->write(writer, u"property"_s);
919 for (DomProperty *v : m_attribute)
920 v->write(writer, u"attribute"_s);
922 writer.writeEndElement();
925void DomAction::setElementProperty(
const QList<DomProperty *> &a)
927 m_children |= Property;
931void DomAction::setElementAttribute(
const QList<DomProperty *> &a)
933 m_children |= Attribute;
937DomActionRef::~DomActionRef() =
default;
939void DomActionRef::read(QXmlStreamReader &reader)
941 const QXmlStreamAttributes &attributes = reader.attributes();
942 for (
const QXmlStreamAttribute &attribute : attributes) {
943 const auto name = attribute.name();
944 if (name == u"name"_s) {
945 setAttributeName(attribute.value().toString());
948 reader.raiseError(
"Unexpected attribute "_L1 + name);
951 while (!reader.hasError()) {
952 switch (reader.readNext()) {
953 case QXmlStreamReader::StartElement : {
954 const auto tag = reader.name();
955 reader.raiseError(
"Unexpected element "_L1 + tag);
958 case QXmlStreamReader::EndElement :
966void DomActionRef::write(QXmlStreamWriter &writer,
const QString &tagName)
const
968 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral(
"actionref") : tagName.toLower());
970 if (hasAttributeName())
971 writer.writeAttribute(u"name"_s, attributeName());
973 writer.writeEndElement();
976DomButtonGroup::~DomButtonGroup()
978 qDeleteAll(m_property);
980 qDeleteAll(m_attribute);
984void DomButtonGroup::read(QXmlStreamReader &reader)
986 const QXmlStreamAttributes &attributes = reader.attributes();
987 for (
const QXmlStreamAttribute &attribute : attributes) {
988 const auto name = attribute.name();
989 if (name == u"name"_s) {
990 setAttributeName(attribute.value().toString());
993 reader.raiseError(
"Unexpected attribute "_L1 + name);
996 while (!reader.hasError()) {
997 switch (reader.readNext()) {
998 case QXmlStreamReader::StartElement : {
999 const auto tag = reader.name();
1000 if (!tag.compare(u"property"_s, Qt::CaseInsensitive)) {
1001 auto *v =
new DomProperty();
1003 m_property.append(v);
1006 if (!tag.compare(u"attribute"_s, Qt::CaseInsensitive)) {
1007 auto *v =
new DomProperty();
1009 m_attribute.append(v);
1012 reader.raiseError(
"Unexpected element "_L1 + tag);
1015 case QXmlStreamReader::EndElement :
1023void DomButtonGroup::write(QXmlStreamWriter &writer,
const QString &tagName)
const
1025 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral(
"buttongroup") : tagName.toLower());
1027 if (hasAttributeName())
1028 writer.writeAttribute(u"name"_s, attributeName());
1030 for (DomProperty *v : m_property)
1031 v->write(writer, u"property"_s);
1033 for (DomProperty *v : m_attribute)
1034 v->write(writer, u"attribute"_s);
1036 writer.writeEndElement();
1039void DomButtonGroup::setElementProperty(
const QList<DomProperty *> &a)
1041 m_children |= Property;
1045void DomButtonGroup::setElementAttribute(
const QList<DomProperty *> &a)
1047 m_children |= Attribute;
1051DomButtonGroups::~DomButtonGroups()
1053 qDeleteAll(m_buttonGroup);
1054 m_buttonGroup.clear();
1057void DomButtonGroups::read(QXmlStreamReader &reader)
1059 while (!reader.hasError()) {
1060 switch (reader.readNext()) {
1061 case QXmlStreamReader::StartElement : {
1062 const auto tag = reader.name();
1063 if (!tag.compare(u"buttongroup"_s, Qt::CaseInsensitive)) {
1064 auto *v =
new DomButtonGroup();
1066 m_buttonGroup.append(v);
1069 reader.raiseError(
"Unexpected element "_L1 + tag);
1072 case QXmlStreamReader::EndElement :
1080void DomButtonGroups::write(QXmlStreamWriter &writer,
const QString &tagName)
const
1082 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral(
"buttongroups") : tagName.toLower());
1084 for (DomButtonGroup *v : m_buttonGroup)
1085 v->write(writer, u"buttongroup"_s);
1087 writer.writeEndElement();
1090void DomButtonGroups::setElementButtonGroup(
const QList<DomButtonGroup *> &a)
1092 m_children |= ButtonGroup;
1096DomCustomWidgets::~DomCustomWidgets()
1098 qDeleteAll(m_customWidget);
1099 m_customWidget.clear();
1102void DomCustomWidgets::read(QXmlStreamReader &reader)
1104 while (!reader.hasError()) {
1105 switch (reader.readNext()) {
1106 case QXmlStreamReader::StartElement : {
1107 const auto tag = reader.name();
1108 if (!tag.compare(u"customwidget"_s, Qt::CaseInsensitive)) {
1109 auto *v =
new DomCustomWidget();
1111 m_customWidget.append(v);
1114 reader.raiseError(
"Unexpected element "_L1 + tag);
1117 case QXmlStreamReader::EndElement :
1125void DomCustomWidgets::write(QXmlStreamWriter &writer,
const QString &tagName)
const
1127 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral(
"customwidgets") : tagName.toLower());
1129 for (DomCustomWidget *v : m_customWidget)
1130 v->write(writer, u"customwidget"_s);
1132 writer.writeEndElement();
1135void DomCustomWidgets::setElementCustomWidget(
const QList<DomCustomWidget *> &a)
1137 m_children |= CustomWidget;
1141DomHeader::~DomHeader() =
default;
1143void DomHeader::read(QXmlStreamReader &reader)
1145 const QXmlStreamAttributes &attributes = reader.attributes();
1146 for (
const QXmlStreamAttribute &attribute : attributes) {
1147 const auto name = attribute.name();
1148 if (name == u"location"_s) {
1149 setAttributeLocation(attribute.value().toString());
1152 reader.raiseError(
"Unexpected attribute "_L1 + name);
1155 while (!reader.hasError()) {
1156 switch (reader.readNext()) {
1157 case QXmlStreamReader::StartElement : {
1158 const auto tag = reader.name();
1159 reader.raiseError(
"Unexpected element "_L1 + tag);
1162 case QXmlStreamReader::EndElement :
1164 case QXmlStreamReader::Characters :
1165 if (!reader.isWhitespace())
1166 m_text.append(reader.text().toString());
1174void DomHeader::write(QXmlStreamWriter &writer,
const QString &tagName)
const
1176 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral(
"header") : tagName.toLower());
1178 if (hasAttributeLocation())
1179 writer.writeAttribute(u"location"_s, attributeLocation());
1181 if (!m_text.isEmpty())
1182 writer.writeCharacters(m_text);
1184 writer.writeEndElement();
1187DomCustomWidget::~DomCustomWidget()
1192 delete m_propertyspecifications;
1195void DomCustomWidget::read(QXmlStreamReader &reader)
1197 while (!reader.hasError()) {
1198 switch (reader.readNext()) {
1199 case QXmlStreamReader::StartElement : {
1200 const auto tag = reader.name();
1201 if (!tag.compare(u"class"_s, Qt::CaseInsensitive)) {
1202 setElementClass(reader.readElementText());
1205 if (!tag.compare(u"extends"_s, Qt::CaseInsensitive)) {
1206 setElementExtends(reader.readElementText());
1209 if (!tag.compare(u"header"_s, Qt::CaseInsensitive)) {
1210 auto *v =
new DomHeader();
1212 setElementHeader(v);
1215 if (!tag.compare(u"sizehint"_s, Qt::CaseInsensitive)) {
1216 auto *v =
new DomSize();
1218 setElementSizeHint(v);
1221 if (!tag.compare(u"addpagemethod"_s, Qt::CaseInsensitive)) {
1222 setElementAddPageMethod(reader.readElementText());
1225 if (!tag.compare(u"container"_s, Qt::CaseInsensitive)) {
1226 setElementContainer(reader.readElementText().toInt());
1229 if (!tag.compare(u"sizepolicy"_s, Qt::CaseInsensitive)) {
1230 qWarning(
"Omitting deprecated element <sizepolicy>.");
1231 reader.skipCurrentElement();
1234 if (!tag.compare(u"pixmap"_s, Qt::CaseInsensitive)) {
1235 setElementPixmap(reader.readElementText());
1238 if (!tag.compare(u"script"_s, Qt::CaseInsensitive)) {
1239 qWarning(
"Omitting deprecated element <script>.");
1240 reader.skipCurrentElement();
1243 if (!tag.compare(u"properties"_s, Qt::CaseInsensitive)) {
1244 qWarning(
"Omitting deprecated element <properties>.");
1245 reader.skipCurrentElement();
1248 if (!tag.compare(u"slots"_s, Qt::CaseInsensitive)) {
1249 auto *v =
new DomSlots();
1254 if (!tag.compare(u"propertyspecifications"_s, Qt::CaseInsensitive)) {
1255 auto *v =
new DomPropertySpecifications();
1257 setElementPropertyspecifications(v);
1260 reader.raiseError(
"Unexpected element "_L1 + tag);
1263 case QXmlStreamReader::EndElement :
1271void DomCustomWidget::write(QXmlStreamWriter &writer,
const QString &tagName)
const
1273 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral(
"customwidget") : tagName.toLower());
1275 if (m_children & Class)
1276 writer.writeTextElement(u"class"_s, m_class);
1278 if (m_children & Extends)
1279 writer.writeTextElement(u"extends"_s, m_extends);
1281 if (m_children & Header)
1282 m_header->write(writer, u"header"_s);
1284 if (m_children & SizeHint)
1285 m_sizeHint->write(writer, u"sizehint"_s);
1287 if (m_children & AddPageMethod)
1288 writer.writeTextElement(u"addpagemethod"_s, m_addPageMethod);
1290 if (m_children & Container)
1291 writer.writeTextElement(u"container"_s, QString::number(m_container));
1293 if (m_children & Pixmap)
1294 writer.writeTextElement(u"pixmap"_s, m_pixmap);
1296 if (m_children & Slots)
1297 m_slots->write(writer, u"slots"_s);
1299 if (m_children & Propertyspecifications)
1300 m_propertyspecifications->write(writer, u"propertyspecifications"_s);
1302 writer.writeEndElement();
1305void DomCustomWidget::setElementClass(
const QString &a)
1307 m_children |= Class;
1311void DomCustomWidget::setElementExtends(
const QString &a)
1313 m_children |= Extends;
1317DomHeader *DomCustomWidget::takeElementHeader()
1319 DomHeader *a = m_header;
1321 m_children ^= Header;
1325void DomCustomWidget::setElementHeader(DomHeader *a)
1328 m_children |= Header;
1332DomSize *DomCustomWidget::takeElementSizeHint()
1334 DomSize *a = m_sizeHint;
1335 m_sizeHint =
nullptr;
1336 m_children ^= SizeHint;
1340void DomCustomWidget::setElementSizeHint(DomSize *a)
1343 m_children |= SizeHint;
1347void DomCustomWidget::setElementAddPageMethod(
const QString &a)
1349 m_children |= AddPageMethod;
1350 m_addPageMethod = a;
1353void DomCustomWidget::setElementContainer(
int a)
1355 m_children |= Container;
1359void DomCustomWidget::setElementPixmap(
const QString &a)
1361 m_children |= Pixmap;
1365DomSlots *DomCustomWidget::takeElementSlots()
1367 DomSlots *a = m_slots;
1369 m_children ^= Slots;
1373void DomCustomWidget::setElementSlots(DomSlots *a)
1376 m_children |= Slots;
1380DomPropertySpecifications *DomCustomWidget::takeElementPropertyspecifications()
1382 DomPropertySpecifications *a = m_propertyspecifications;
1383 m_propertyspecifications =
nullptr;
1384 m_children ^= Propertyspecifications;
1388void DomCustomWidget::setElementPropertyspecifications(DomPropertySpecifications *a)
1390 delete m_propertyspecifications;
1391 m_children |= Propertyspecifications;
1392 m_propertyspecifications = a;
1395void DomCustomWidget::clearElementClass()
1397 m_children &= ~Class;
1400void DomCustomWidget::clearElementExtends()
1402 m_children &= ~Extends;
1405void DomCustomWidget::clearElementHeader()
1409 m_children &= ~Header;
1412void DomCustomWidget::clearElementSizeHint()
1415 m_sizeHint =
nullptr;
1416 m_children &= ~SizeHint;
1419void DomCustomWidget::clearElementAddPageMethod()
1421 m_children &= ~AddPageMethod;
1424void DomCustomWidget::clearElementContainer()
1426 m_children &= ~Container;
1429void DomCustomWidget::clearElementPixmap()
1431 m_children &= ~Pixmap;
1434void DomCustomWidget::clearElementSlots()
1438 m_children &= ~Slots;
1441void DomCustomWidget::clearElementPropertyspecifications()
1443 delete m_propertyspecifications;
1444 m_propertyspecifications =
nullptr;
1445 m_children &= ~Propertyspecifications;
1448DomLayoutDefault::~DomLayoutDefault() =
default;
1450void DomLayoutDefault::read(QXmlStreamReader &reader)
1452 const QXmlStreamAttributes &attributes = reader.attributes();
1453 for (
const QXmlStreamAttribute &attribute : attributes) {
1454 const auto name = attribute.name();
1455 if (name == u"spacing"_s) {
1456 setAttributeSpacing(attribute.value().toInt());
1459 if (name == u"margin"_s) {
1460 setAttributeMargin(attribute.value().toInt());
1463 reader.raiseError(
"Unexpected attribute "_L1 + name);
1466 while (!reader.hasError()) {
1467 switch (reader.readNext()) {
1468 case QXmlStreamReader::StartElement : {
1469 const auto tag = reader.name();
1470 reader.raiseError(
"Unexpected element "_L1 + tag);
1473 case QXmlStreamReader::EndElement :
1481void DomLayoutDefault::write(QXmlStreamWriter &writer,
const QString &tagName)
const
1483 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral(
"layoutdefault") : tagName.toLower());
1485 if (hasAttributeSpacing())
1486 writer.writeAttribute(u"spacing"_s, QString::number(attributeSpacing()));
1488 if (hasAttributeMargin())
1489 writer.writeAttribute(u"margin"_s, QString::number(attributeMargin()));
1491 writer.writeEndElement();
1494DomLayoutFunction::~DomLayoutFunction() =
default;
1496void DomLayoutFunction::read(QXmlStreamReader &reader)
1498 const QXmlStreamAttributes &attributes = reader.attributes();
1499 for (
const QXmlStreamAttribute &attribute : attributes) {
1500 const auto name = attribute.name();
1501 if (name == u"spacing"_s) {
1502 setAttributeSpacing(attribute.value().toString());
1505 if (name == u"margin"_s) {
1506 setAttributeMargin(attribute.value().toString());
1509 reader.raiseError(
"Unexpected attribute "_L1 + name);
1512 while (!reader.hasError()) {
1513 switch (reader.readNext()) {
1514 case QXmlStreamReader::StartElement : {
1515 const auto tag = reader.name();
1516 reader.raiseError(
"Unexpected element "_L1 + tag);
1519 case QXmlStreamReader::EndElement :
1527void DomLayoutFunction::write(QXmlStreamWriter &writer,
const QString &tagName)
const
1529 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral(
"layoutfunction") : tagName.toLower());
1531 if (hasAttributeSpacing())
1532 writer.writeAttribute(u"spacing"_s, attributeSpacing());
1534 if (hasAttributeMargin())
1535 writer.writeAttribute(u"margin"_s, attributeMargin());
1537 writer.writeEndElement();
1540DomTabStops::~DomTabStops()
1545void DomTabStops::read(QXmlStreamReader &reader)
1547 while (!reader.hasError()) {
1548 switch (reader.readNext()) {
1549 case QXmlStreamReader::StartElement : {
1550 const auto tag = reader.name();
1551 if (!tag.compare(u"tabstop"_s, Qt::CaseInsensitive)) {
1552 m_tabStop.append(reader.readElementText());
1555 reader.raiseError(
"Unexpected element "_L1 + tag);
1558 case QXmlStreamReader::EndElement :
1566void DomTabStops::write(QXmlStreamWriter &writer,
const QString &tagName)
const
1568 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral(
"tabstops") : tagName.toLower());
1570 for (
const QString &v : m_tabStop)
1571 writer.writeTextElement(u"tabstop"_s, v);
1573 writer.writeEndElement();
1576void DomTabStops::setElementTabStop(
const QStringList &a)
1578 m_children |= TabStop;
1582DomLayout::~DomLayout()
1584 qDeleteAll(m_property);
1586 qDeleteAll(m_attribute);
1587 m_attribute.clear();
1592void DomLayout::read(QXmlStreamReader &reader)
1594 const QXmlStreamAttributes &attributes = reader.attributes();
1595 for (
const QXmlStreamAttribute &attribute : attributes) {
1596 const auto name = attribute.name();
1597 if (name == u"class"_s) {
1598 setAttributeClass(attribute.value().toString());
1601 if (name == u"name"_s) {
1602 setAttributeName(attribute.value().toString());
1605 if (name == u"stretch"_s) {
1606 setAttributeStretch(attribute.value().toString());
1609 if (name == u"rowstretch"_s) {
1610 setAttributeRowStretch(attribute.value().toString());
1613 if (name == u"columnstretch"_s) {
1614 setAttributeColumnStretch(attribute.value().toString());
1617 if (name == u"rowminimumheight"_s) {
1618 setAttributeRowMinimumHeight(attribute.value().toString());
1621 if (name == u"columnminimumwidth"_s) {
1622 setAttributeColumnMinimumWidth(attribute.value().toString());
1625 reader.raiseError(
"Unexpected attribute "_L1 + name);
1628 while (!reader.hasError()) {
1629 switch (reader.readNext()) {
1630 case QXmlStreamReader::StartElement : {
1631 const auto tag = reader.name();
1632 if (!tag.compare(u"property"_s, Qt::CaseInsensitive)) {
1633 auto *v =
new DomProperty();
1635 m_property.append(v);
1638 if (!tag.compare(u"attribute"_s, Qt::CaseInsensitive)) {
1639 auto *v =
new DomProperty();
1641 m_attribute.append(v);
1644 if (!tag.compare(u"item"_s, Qt::CaseInsensitive)) {
1645 auto *v =
new DomLayoutItem();
1650 reader.raiseError(
"Unexpected element "_L1 + tag);
1653 case QXmlStreamReader::EndElement :
1661void DomLayout::write(QXmlStreamWriter &writer,
const QString &tagName)
const
1663 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral(
"layout") : tagName.toLower());
1665 if (hasAttributeClass())
1666 writer.writeAttribute(u"class"_s, attributeClass());
1668 if (hasAttributeName())
1669 writer.writeAttribute(u"name"_s, attributeName());
1671 if (hasAttributeStretch())
1672 writer.writeAttribute(u"stretch"_s, attributeStretch());
1674 if (hasAttributeRowStretch())
1675 writer.writeAttribute(u"rowstretch"_s, attributeRowStretch());
1677 if (hasAttributeColumnStretch())
1678 writer.writeAttribute(u"columnstretch"_s, attributeColumnStretch());
1680 if (hasAttributeRowMinimumHeight())
1681 writer.writeAttribute(u"rowminimumheight"_s, attributeRowMinimumHeight());
1683 if (hasAttributeColumnMinimumWidth())
1684 writer.writeAttribute(u"columnminimumwidth"_s, attributeColumnMinimumWidth());
1686 for (DomProperty *v : m_property)
1687 v->write(writer, u"property"_s);
1689 for (DomProperty *v : m_attribute)
1690 v->write(writer, u"attribute"_s);
1692 for (DomLayoutItem *v : m_item)
1693 v->write(writer, u"item"_s);
1695 writer.writeEndElement();
1698void DomLayout::setElementProperty(
const QList<DomProperty *> &a)
1700 m_children |= Property;
1704void DomLayout::setElementAttribute(
const QList<DomProperty *> &a)
1706 m_children |= Attribute;
1710void DomLayout::setElementItem(
const QList<DomLayoutItem *> &a)
1716DomLayoutItem::~DomLayoutItem()
1723void DomLayoutItem::clear()
1736void DomLayoutItem::read(QXmlStreamReader &reader)
1738 const QXmlStreamAttributes &attributes = reader.attributes();
1739 for (
const QXmlStreamAttribute &attribute : attributes) {
1740 const auto name = attribute.name();
1741 if (name == u"row"_s) {
1742 setAttributeRow(attribute.value().toInt());
1745 if (name == u"column"_s) {
1746 setAttributeColumn(attribute.value().toInt());
1749 if (name == u"rowspan"_s) {
1750 setAttributeRowSpan(attribute.value().toInt());
1753 if (name == u"colspan"_s) {
1754 setAttributeColSpan(attribute.value().toInt());
1757 if (name == u"alignment"_s) {
1758 setAttributeAlignment(attribute.value().toString());
1761 reader.raiseError(
"Unexpected attribute "_L1 + name);
1764 while (!reader.hasError()) {
1765 switch (reader.readNext()) {
1766 case QXmlStreamReader::StartElement : {
1767 const auto tag = reader.name();
1768 if (!tag.compare(u"widget"_s, Qt::CaseInsensitive)) {
1769 auto *v =
new DomWidget();
1771 setElementWidget(v);
1774 if (!tag.compare(u"layout"_s, Qt::CaseInsensitive)) {
1775 auto *v =
new DomLayout();
1777 setElementLayout(v);
1780 if (!tag.compare(u"spacer"_s, Qt::CaseInsensitive)) {
1781 auto *v =
new DomSpacer();
1783 setElementSpacer(v);
1786 reader.raiseError(
"Unexpected element "_L1 + tag);
1789 case QXmlStreamReader::EndElement :
1797void DomLayoutItem::write(QXmlStreamWriter &writer,
const QString &tagName)
const
1799 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral(
"layoutitem") : tagName.toLower());
1801 if (hasAttributeRow())
1802 writer.writeAttribute(u"row"_s, QString::number(attributeRow()));
1804 if (hasAttributeColumn())
1805 writer.writeAttribute(u"column"_s, QString::number(attributeColumn()));
1807 if (hasAttributeRowSpan())
1808 writer.writeAttribute(u"rowspan"_s, QString::number(attributeRowSpan()));
1810 if (hasAttributeColSpan())
1811 writer.writeAttribute(u"colspan"_s, QString::number(attributeColSpan()));
1813 if (hasAttributeAlignment())
1814 writer.writeAttribute(u"alignment"_s, attributeAlignment());
1818 if (m_widget !=
nullptr)
1819 m_widget->write(writer, u"widget"_s);
1823 if (m_layout !=
nullptr)
1824 m_layout->write(writer, u"layout"_s);
1828 if (m_spacer !=
nullptr)
1829 m_spacer->write(writer, u"spacer"_s);
1835 writer.writeEndElement();
1838DomWidget *DomLayoutItem::takeElementWidget()
1840 DomWidget *a = m_widget;
1845void DomLayoutItem::setElementWidget(DomWidget *a)
1852DomLayout *DomLayoutItem::takeElementLayout()
1854 DomLayout *a = m_layout;
1859void DomLayoutItem::setElementLayout(DomLayout *a)
1866DomSpacer *DomLayoutItem::takeElementSpacer()
1868 DomSpacer *a = m_spacer;
1873void DomLayoutItem::setElementSpacer(DomSpacer *a)
1882 qDeleteAll(m_property);
1886void DomRow::read(QXmlStreamReader &reader)
1888 while (!reader.hasError()) {
1889 switch (reader.readNext()) {
1890 case QXmlStreamReader::StartElement : {
1891 const auto tag = reader.name();
1892 if (!tag.compare(u"property"_s, Qt::CaseInsensitive)) {
1893 auto *v =
new DomProperty();
1895 m_property.append(v);
1898 reader.raiseError(
"Unexpected element "_L1 + tag);
1901 case QXmlStreamReader::EndElement :
1909void DomRow::write(QXmlStreamWriter &writer,
const QString &tagName)
const
1911 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral(
"row") : tagName.toLower());
1913 for (DomProperty *v : m_property)
1914 v->write(writer, u"property"_s);
1916 writer.writeEndElement();
1919void DomRow::setElementProperty(
const QList<DomProperty *> &a)
1921 m_children |= Property;
1925DomColumn::~DomColumn()
1927 qDeleteAll(m_property);
1931void DomColumn::read(QXmlStreamReader &reader)
1933 while (!reader.hasError()) {
1934 switch (reader.readNext()) {
1935 case QXmlStreamReader::StartElement : {
1936 const auto tag = reader.name();
1937 if (!tag.compare(u"property"_s, Qt::CaseInsensitive)) {
1938 auto *v =
new DomProperty();
1940 m_property.append(v);
1943 reader.raiseError(
"Unexpected element "_L1 + tag);
1946 case QXmlStreamReader::EndElement :
1954void DomColumn::write(QXmlStreamWriter &writer,
const QString &tagName)
const
1956 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral(
"column") : tagName.toLower());
1958 for (DomProperty *v : m_property)
1959 v->write(writer, u"property"_s);
1961 writer.writeEndElement();
1964void DomColumn::setElementProperty(
const QList<DomProperty *> &a)
1966 m_children |= Property;
1972 qDeleteAll(m_property);
1978void DomItem::read(QXmlStreamReader &reader)
1980 const QXmlStreamAttributes &attributes = reader.attributes();
1981 for (
const QXmlStreamAttribute &attribute : attributes) {
1982 const auto name = attribute.name();
1983 if (name == u"row"_s) {
1984 setAttributeRow(attribute.value().toInt());
1987 if (name == u"column"_s) {
1988 setAttributeColumn(attribute.value().toInt());
1991 reader.raiseError(
"Unexpected attribute "_L1 + name);
1994 while (!reader.hasError()) {
1995 switch (reader.readNext()) {
1996 case QXmlStreamReader::StartElement : {
1997 const auto tag = reader.name();
1998 if (!tag.compare(u"property"_s, Qt::CaseInsensitive)) {
1999 auto *v =
new DomProperty();
2001 m_property.append(v);
2004 if (!tag.compare(u"item"_s, Qt::CaseInsensitive)) {
2005 auto *v =
new DomItem();
2010 reader.raiseError(
"Unexpected element "_L1 + tag);
2013 case QXmlStreamReader::EndElement :
2021void DomItem::write(QXmlStreamWriter &writer,
const QString &tagName)
const
2023 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral(
"item") : tagName.toLower());
2025 if (hasAttributeRow())
2026 writer.writeAttribute(u"row"_s, QString::number(attributeRow()));
2028 if (hasAttributeColumn())
2029 writer.writeAttribute(u"column"_s, QString::number(attributeColumn()));
2031 for (DomProperty *v : m_property)
2032 v->write(writer, u"property"_s);
2034 for (DomItem *v : m_item)
2035 v->write(writer, u"item"_s);
2037 writer.writeEndElement();
2040void DomItem::setElementProperty(
const QList<DomProperty *> &a)
2042 m_children |= Property;
2046void DomItem::setElementItem(
const QList<DomItem *> &a)
2052DomWidget::~DomWidget()
2055 qDeleteAll(m_property);
2057 qDeleteAll(m_attribute);
2058 m_attribute.clear();
2061 qDeleteAll(m_column);
2065 qDeleteAll(m_layout);
2067 qDeleteAll(m_widget);
2069 qDeleteAll(m_action);
2071 qDeleteAll(m_actionGroup);
2072 m_actionGroup.clear();
2073 qDeleteAll(m_addAction);
2074 m_addAction.clear();
2078void DomWidget::read(QXmlStreamReader &reader)
2080 const QXmlStreamAttributes &attributes = reader.attributes();
2081 for (
const QXmlStreamAttribute &attribute : attributes) {
2082 const auto name = attribute.name();
2083 if (name == u"class"_s) {
2084 setAttributeClass(attribute.value().toString());
2087 if (name == u"name"_s) {
2088 setAttributeName(attribute.value().toString());
2091 if (name == u"native"_s) {
2092 setAttributeNative(attribute.value() == u"true"_s);
2095 reader.raiseError(
"Unexpected attribute "_L1 + name);
2098 while (!reader.hasError()) {
2099 switch (reader.readNext()) {
2100 case QXmlStreamReader::StartElement : {
2101 const auto tag = reader.name();
2102 if (!tag.compare(u"class"_s, Qt::CaseInsensitive)) {
2103 m_class.append(reader.readElementText());
2106 if (!tag.compare(u"property"_s, Qt::CaseInsensitive)) {
2107 auto *v =
new DomProperty();
2109 m_property.append(v);
2112 if (!tag.compare(u"script"_s, Qt::CaseInsensitive)) {
2113 qWarning(
"Omitting deprecated element <script>.");
2114 reader.skipCurrentElement();
2117 if (!tag.compare(u"widgetdata"_s, Qt::CaseInsensitive)) {
2118 qWarning(
"Omitting deprecated element <widgetdata>.");
2119 reader.skipCurrentElement();
2122 if (!tag.compare(u"attribute"_s, Qt::CaseInsensitive)) {
2123 auto *v =
new DomProperty();
2125 m_attribute.append(v);
2128 if (!tag.compare(u"row"_s, Qt::CaseInsensitive)) {
2129 auto *v =
new DomRow();
2134 if (!tag.compare(u"column"_s, Qt::CaseInsensitive)) {
2135 auto *v =
new DomColumn();
2140 if (!tag.compare(u"item"_s, Qt::CaseInsensitive)) {
2141 auto *v =
new DomItem();
2146 if (!tag.compare(u"layout"_s, Qt::CaseInsensitive)) {
2147 auto *v =
new DomLayout();
2152 if (!tag.compare(u"widget"_s, Qt::CaseInsensitive)) {
2153 auto *v =
new DomWidget();
2158 if (!tag.compare(u"action"_s, Qt::CaseInsensitive)) {
2159 auto *v =
new DomAction();
2164 if (!tag.compare(u"actiongroup"_s, Qt::CaseInsensitive)) {
2165 auto *v =
new DomActionGroup();
2167 m_actionGroup.append(v);
2170 if (!tag.compare(u"addaction"_s, Qt::CaseInsensitive)) {
2171 auto *v =
new DomActionRef();
2173 m_addAction.append(v);
2176 if (!tag.compare(u"zorder"_s, Qt::CaseInsensitive)) {
2177 m_zOrder.append(reader.readElementText());
2180 reader.raiseError(
"Unexpected element "_L1 + tag);
2183 case QXmlStreamReader::EndElement :
2191void DomWidget::write(QXmlStreamWriter &writer,
const QString &tagName)
const
2193 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral(
"widget") : tagName.toLower());
2195 if (hasAttributeClass())
2196 writer.writeAttribute(u"class"_s, attributeClass());
2198 if (hasAttributeName())
2199 writer.writeAttribute(u"name"_s, attributeName());
2201 if (hasAttributeNative())
2202 writer.writeAttribute(u"native"_s, (attributeNative() ? u"true"_s : u"false"_s));
2204 for (
const QString &v : m_class)
2205 writer.writeTextElement(u"class"_s, v);
2207 for (DomProperty *v : m_property)
2208 v->write(writer, u"property"_s);
2210 for (DomProperty *v : m_attribute)
2211 v->write(writer, u"attribute"_s);
2213 for (DomRow *v : m_row)
2214 v->write(writer, u"row"_s);
2216 for (DomColumn *v : m_column)
2217 v->write(writer, u"column"_s);
2219 for (DomItem *v : m_item)
2220 v->write(writer, u"item"_s);
2222 for (DomLayout *v : m_layout)
2223 v->write(writer, u"layout"_s);
2225 for (DomWidget *v : m_widget)
2226 v->write(writer, u"widget"_s);
2228 for (DomAction *v : m_action)
2229 v->write(writer, u"action"_s);
2231 for (DomActionGroup *v : m_actionGroup)
2232 v->write(writer, u"actiongroup"_s);
2234 for (DomActionRef *v : m_addAction)
2235 v->write(writer, u"addaction"_s);
2237 for (
const QString &v : m_zOrder)
2238 writer.writeTextElement(u"zorder"_s, v);
2240 writer.writeEndElement();
2243void DomWidget::setElementClass(
const QStringList &a)
2245 m_children |= Class;
2249void DomWidget::setElementProperty(
const QList<DomProperty *> &a)
2251 m_children |= Property;
2255void DomWidget::setElementAttribute(
const QList<DomProperty *> &a)
2257 m_children |= Attribute;
2261void DomWidget::setElementRow(
const QList<DomRow *> &a)
2267void DomWidget::setElementColumn(
const QList<DomColumn *> &a)
2269 m_children |= Column;
2273void DomWidget::setElementItem(
const QList<DomItem *> &a)
2279void DomWidget::setElementLayout(
const QList<DomLayout *> &a)
2281 m_children |= Layout;
2285void DomWidget::setElementWidget(
const QList<DomWidget *> &a)
2287 m_children |= Widget;
2291void DomWidget::setElementAction(
const QList<DomAction *> &a)
2293 m_children |= Action;
2297void DomWidget::setElementActionGroup(
const QList<DomActionGroup *> &a)
2299 m_children |= ActionGroup;
2303void DomWidget::setElementAddAction(
const QList<DomActionRef *> &a)
2305 m_children |= AddAction;
2309void DomWidget::setElementZOrder(
const QStringList &a)
2311 m_children |= ZOrder;
2315DomSpacer::~DomSpacer()
2317 qDeleteAll(m_property);
2321void DomSpacer::read(QXmlStreamReader &reader)
2323 const QXmlStreamAttributes &attributes = reader.attributes();
2324 for (
const QXmlStreamAttribute &attribute : attributes) {
2325 const auto name = attribute.name();
2326 if (name == u"name"_s) {
2327 setAttributeName(attribute.value().toString());
2330 reader.raiseError(
"Unexpected attribute "_L1 + name);
2333 while (!reader.hasError()) {
2334 switch (reader.readNext()) {
2335 case QXmlStreamReader::StartElement : {
2336 const auto tag = reader.name();
2337 if (!tag.compare(u"property"_s, Qt::CaseInsensitive)) {
2338 auto *v =
new DomProperty();
2340 m_property.append(v);
2343 reader.raiseError(
"Unexpected element "_L1 + tag);
2346 case QXmlStreamReader::EndElement :
2354void DomSpacer::write(QXmlStreamWriter &writer,
const QString &tagName)
const
2356 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral(
"spacer") : tagName.toLower());
2358 if (hasAttributeName())
2359 writer.writeAttribute(u"name"_s, attributeName());
2361 for (DomProperty *v : m_property)
2362 v->write(writer, u"property"_s);
2364 writer.writeEndElement();
2367void DomSpacer::setElementProperty(
const QList<DomProperty *> &a)
2369 m_children |= Property;
2373DomColor::~DomColor() =
default;
2375void DomColor::read(QXmlStreamReader &reader)
2377 const QXmlStreamAttributes &attributes = reader.attributes();
2378 for (
const QXmlStreamAttribute &attribute : attributes) {
2379 const auto name = attribute.name();
2380 if (name == u"alpha"_s) {
2381 setAttributeAlpha(attribute.value().toInt());
2384 reader.raiseError(
"Unexpected attribute "_L1 + name);
2387 while (!reader.hasError()) {
2388 switch (reader.readNext()) {
2389 case QXmlStreamReader::StartElement : {
2390 const auto tag = reader.name();
2391 if (!tag.compare(u"red"_s, Qt::CaseInsensitive)) {
2392 setElementRed(reader.readElementText().toInt());
2395 if (!tag.compare(u"green"_s, Qt::CaseInsensitive)) {
2396 setElementGreen(reader.readElementText().toInt());
2399 if (!tag.compare(u"blue"_s, Qt::CaseInsensitive)) {
2400 setElementBlue(reader.readElementText().toInt());
2403 reader.raiseError(
"Unexpected element "_L1 + tag);
2406 case QXmlStreamReader::EndElement :
2414void DomColor::write(QXmlStreamWriter &writer,
const QString &tagName)
const
2416 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral(
"color") : tagName.toLower());
2418 if (hasAttributeAlpha())
2419 writer.writeAttribute(u"alpha"_s, QString::number(attributeAlpha()));
2421 if (m_children & Red)
2422 writer.writeTextElement(u"red"_s, QString::number(m_red));
2424 if (m_children & Green)
2425 writer.writeTextElement(u"green"_s, QString::number(m_green));
2427 if (m_children & Blue)
2428 writer.writeTextElement(u"blue"_s, QString::number(m_blue));
2430 writer.writeEndElement();
2433void DomColor::setElementRed(
int a)
2439void DomColor::setElementGreen(
int a)
2441 m_children |= Green;
2445void DomColor::setElementBlue(
int a)
2451void DomColor::clearElementRed()
2456void DomColor::clearElementGreen()
2458 m_children &= ~Green;
2461void DomColor::clearElementBlue()
2463 m_children &= ~Blue;
2466DomGradientStop::~DomGradientStop()
2471void DomGradientStop::read(QXmlStreamReader &reader)
2473 const QXmlStreamAttributes &attributes = reader.attributes();
2474 for (
const QXmlStreamAttribute &attribute : attributes) {
2475 const auto name = attribute.name();
2476 if (name == u"position"_s) {
2477 setAttributePosition(attribute.value().toDouble());
2480 reader.raiseError(
"Unexpected attribute "_L1 + name);
2483 while (!reader.hasError()) {
2484 switch (reader.readNext()) {
2485 case QXmlStreamReader::StartElement : {
2486 const auto tag = reader.name();
2487 if (!tag.compare(u"color"_s, Qt::CaseInsensitive)) {
2488 auto *v =
new DomColor();
2493 reader.raiseError(
"Unexpected element "_L1 + tag);
2496 case QXmlStreamReader::EndElement :
2504void DomGradientStop::write(QXmlStreamWriter &writer,
const QString &tagName)
const
2506 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral(
"gradientstop") : tagName.toLower());
2508 if (hasAttributePosition())
2509 writer.writeAttribute(u"position"_s, QString::number(attributePosition(),
'f', 15));
2511 if (m_children & Color)
2512 m_color->write(writer, u"color"_s);
2514 writer.writeEndElement();
2517DomColor *DomGradientStop::takeElementColor()
2519 DomColor *a = m_color;
2521 m_children ^= Color;
2525void DomGradientStop::setElementColor(DomColor *a)
2528 m_children |= Color;
2532void DomGradientStop::clearElementColor()
2536 m_children &= ~Color;
2539DomGradient::~DomGradient()
2541 qDeleteAll(m_gradientStop);
2542 m_gradientStop.clear();
2545void DomGradient::read(QXmlStreamReader &reader)
2547 const QXmlStreamAttributes &attributes = reader.attributes();
2548 for (
const QXmlStreamAttribute &attribute : attributes) {
2549 const auto name = attribute.name();
2550 if (name == u"startx"_s) {
2551 setAttributeStartX(attribute.value().toDouble());
2554 if (name == u"starty"_s) {
2555 setAttributeStartY(attribute.value().toDouble());
2558 if (name == u"endx"_s) {
2559 setAttributeEndX(attribute.value().toDouble());
2562 if (name == u"endy"_s) {
2563 setAttributeEndY(attribute.value().toDouble());
2566 if (name == u"centralx"_s) {
2567 setAttributeCentralX(attribute.value().toDouble());
2570 if (name == u"centraly"_s) {
2571 setAttributeCentralY(attribute.value().toDouble());
2574 if (name == u"focalx"_s) {
2575 setAttributeFocalX(attribute.value().toDouble());
2578 if (name == u"focaly"_s) {
2579 setAttributeFocalY(attribute.value().toDouble());
2582 if (name == u"radius"_s) {
2583 setAttributeRadius(attribute.value().toDouble());
2586 if (name == u"angle"_s) {
2587 setAttributeAngle(attribute.value().toDouble());
2590 if (name == u"type"_s) {
2591 setAttributeType(attribute.value().toString());
2594 if (name == u"spread"_s) {
2595 setAttributeSpread(attribute.value().toString());
2598 if (name == u"coordinatemode"_s) {
2599 setAttributeCoordinateMode(attribute.value().toString());
2602 reader.raiseError(
"Unexpected attribute "_L1 + name);
2605 while (!reader.hasError()) {
2606 switch (reader.readNext()) {
2607 case QXmlStreamReader::StartElement : {
2608 const auto tag = reader.name();
2609 if (!tag.compare(u"gradientstop"_s, Qt::CaseInsensitive)) {
2610 auto *v =
new DomGradientStop();
2612 m_gradientStop.append(v);
2615 reader.raiseError(
"Unexpected element "_L1 + tag);
2618 case QXmlStreamReader::EndElement :
2626void DomGradient::write(QXmlStreamWriter &writer,
const QString &tagName)
const
2628 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral(
"gradient") : tagName.toLower());
2630 if (hasAttributeStartX())
2631 writer.writeAttribute(u"startx"_s, QString::number(attributeStartX(),
'f', 15));
2633 if (hasAttributeStartY())
2634 writer.writeAttribute(u"starty"_s, QString::number(attributeStartY(),
'f', 15));
2636 if (hasAttributeEndX())
2637 writer.writeAttribute(u"endx"_s, QString::number(attributeEndX(),
'f', 15));
2639 if (hasAttributeEndY())
2640 writer.writeAttribute(u"endy"_s, QString::number(attributeEndY(),
'f', 15));
2642 if (hasAttributeCentralX())
2643 writer.writeAttribute(u"centralx"_s, QString::number(attributeCentralX(),
'f', 15));
2645 if (hasAttributeCentralY())
2646 writer.writeAttribute(u"centraly"_s, QString::number(attributeCentralY(),
'f', 15));
2648 if (hasAttributeFocalX())
2649 writer.writeAttribute(u"focalx"_s, QString::number(attributeFocalX(),
'f', 15));
2651 if (hasAttributeFocalY())
2652 writer.writeAttribute(u"focaly"_s, QString::number(attributeFocalY(),
'f', 15));
2654 if (hasAttributeRadius())
2655 writer.writeAttribute(u"radius"_s, QString::number(attributeRadius(),
'f', 15));
2657 if (hasAttributeAngle())
2658 writer.writeAttribute(u"angle"_s, QString::number(attributeAngle(),
'f', 15));
2660 if (hasAttributeType())
2661 writer.writeAttribute(u"type"_s, attributeType());
2663 if (hasAttributeSpread())
2664 writer.writeAttribute(u"spread"_s, attributeSpread());
2666 if (hasAttributeCoordinateMode())
2667 writer.writeAttribute(u"coordinatemode"_s, attributeCoordinateMode());
2669 for (DomGradientStop *v : m_gradientStop)
2670 v->write(writer, u"gradientstop"_s);
2672 writer.writeEndElement();
2675void DomGradient::setElementGradientStop(
const QList<DomGradientStop *> &a)
2677 m_children |= GradientStop;
2681DomBrush::~DomBrush()
2688void DomBrush::clear()
2697 m_texture =
nullptr;
2698 m_gradient =
nullptr;
2701void DomBrush::read(QXmlStreamReader &reader)
2703 const QXmlStreamAttributes &attributes = reader.attributes();
2704 for (
const QXmlStreamAttribute &attribute : attributes) {
2705 const auto name = attribute.name();
2706 if (name == u"brushstyle"_s) {
2707 setAttributeBrushStyle(attribute.value().toString());
2710 reader.raiseError(
"Unexpected attribute "_L1 + name);
2713 while (!reader.hasError()) {
2714 switch (reader.readNext()) {
2715 case QXmlStreamReader::StartElement : {
2716 const auto tag = reader.name();
2717 if (!tag.compare(u"color"_s, Qt::CaseInsensitive)) {
2718 auto *v =
new DomColor();
2723 if (!tag.compare(u"texture"_s, Qt::CaseInsensitive)) {
2724 auto *v =
new DomProperty();
2726 setElementTexture(v);
2729 if (!tag.compare(u"gradient"_s, Qt::CaseInsensitive)) {
2730 auto *v =
new DomGradient();
2732 setElementGradient(v);
2735 reader.raiseError(
"Unexpected element "_L1 + tag);
2738 case QXmlStreamReader::EndElement :
2746void DomBrush::write(QXmlStreamWriter &writer,
const QString &tagName)
const
2748 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral(
"brush") : tagName.toLower());
2750 if (hasAttributeBrushStyle())
2751 writer.writeAttribute(u"brushstyle"_s, attributeBrushStyle());
2755 if (m_color !=
nullptr)
2756 m_color->write(writer, u"color"_s);
2760 if (m_texture !=
nullptr)
2761 m_texture->write(writer, u"texture"_s);
2765 if (m_gradient !=
nullptr)
2766 m_gradient->write(writer, u"gradient"_s);
2772 writer.writeEndElement();
2775DomColor *DomBrush::takeElementColor()
2777 DomColor *a = m_color;
2782void DomBrush::setElementColor(DomColor *a)
2789DomProperty *DomBrush::takeElementTexture()
2791 DomProperty *a = m_texture;
2792 m_texture =
nullptr;
2796void DomBrush::setElementTexture(DomProperty *a)
2803DomGradient *DomBrush::takeElementGradient()
2805 DomGradient *a = m_gradient;
2806 m_gradient =
nullptr;
2810void DomBrush::setElementGradient(DomGradient *a)
2817DomColorRole::~DomColorRole()
2822void DomColorRole::read(QXmlStreamReader &reader)
2824 const QXmlStreamAttributes &attributes = reader.attributes();
2825 for (
const QXmlStreamAttribute &attribute : attributes) {
2826 const auto name = attribute.name();
2827 if (name == u"role"_s) {
2828 setAttributeRole(attribute.value().toString());
2831 reader.raiseError(
"Unexpected attribute "_L1 + name);
2834 while (!reader.hasError()) {
2835 switch (reader.readNext()) {
2836 case QXmlStreamReader::StartElement : {
2837 const auto tag = reader.name();
2838 if (!tag.compare(u"brush"_s, Qt::CaseInsensitive)) {
2839 auto *v =
new DomBrush();
2844 reader.raiseError(
"Unexpected element "_L1 + tag);
2847 case QXmlStreamReader::EndElement :
2855void DomColorRole::write(QXmlStreamWriter &writer,
const QString &tagName)
const
2857 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral(
"colorrole") : tagName.toLower());
2859 if (hasAttributeRole())
2860 writer.writeAttribute(u"role"_s, attributeRole());
2862 if (m_children & Brush)
2863 m_brush->write(writer, u"brush"_s);
2865 writer.writeEndElement();
2868DomBrush *DomColorRole::takeElementBrush()
2870 DomBrush *a = m_brush;
2872 m_children ^= Brush;
2876void DomColorRole::setElementBrush(DomBrush *a)
2879 m_children |= Brush;
2883void DomColorRole::clearElementBrush()
2887 m_children &= ~Brush;
2890DomColorGroup::~DomColorGroup()
2892 qDeleteAll(m_colorRole);
2893 m_colorRole.clear();
2894 qDeleteAll(m_color);
2898void DomColorGroup::read(QXmlStreamReader &reader)
2900 while (!reader.hasError()) {
2901 switch (reader.readNext()) {
2902 case QXmlStreamReader::StartElement : {
2903 const auto tag = reader.name();
2904 if (!tag.compare(u"colorrole"_s, Qt::CaseInsensitive)) {
2905 auto *v =
new DomColorRole();
2907 m_colorRole.append(v);
2910 if (!tag.compare(u"color"_s, Qt::CaseInsensitive)) {
2911 auto *v =
new DomColor();
2916 reader.raiseError(
"Unexpected element "_L1 + tag);
2919 case QXmlStreamReader::EndElement :
2927void DomColorGroup::write(QXmlStreamWriter &writer,
const QString &tagName)
const
2929 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral(
"colorgroup") : tagName.toLower());
2931 for (DomColorRole *v : m_colorRole)
2932 v->write(writer, u"colorrole"_s);
2934 for (DomColor *v : m_color)
2935 v->write(writer, u"color"_s);
2937 writer.writeEndElement();
2940void DomColorGroup::setElementColorRole(
const QList<DomColorRole *> &a)
2942 m_children |= ColorRole;
2946void DomColorGroup::setElementColor(
const QList<DomColor *> &a)
2948 m_children |= Color;
2952DomPalette::~DomPalette()
2959void DomPalette::read(QXmlStreamReader &reader)
2961 while (!reader.hasError()) {
2962 switch (reader.readNext()) {
2963 case QXmlStreamReader::StartElement : {
2964 const auto tag = reader.name();
2965 if (!tag.compare(u"active"_s, Qt::CaseInsensitive)) {
2966 auto *v =
new DomColorGroup();
2968 setElementActive(v);
2971 if (!tag.compare(u"inactive"_s, Qt::CaseInsensitive)) {
2972 auto *v =
new DomColorGroup();
2974 setElementInactive(v);
2977 if (!tag.compare(u"disabled"_s, Qt::CaseInsensitive)) {
2978 auto *v =
new DomColorGroup();
2980 setElementDisabled(v);
2983 reader.raiseError(
"Unexpected element "_L1 + tag);
2986 case QXmlStreamReader::EndElement :
2994void DomPalette::write(QXmlStreamWriter &writer,
const QString &tagName)
const
2996 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral(
"palette") : tagName.toLower());
2998 if (m_children & Active)
2999 m_active->write(writer, u"active"_s);
3001 if (m_children & Inactive)
3002 m_inactive->write(writer, u"inactive"_s);
3004 if (m_children & Disabled)
3005 m_disabled->write(writer, u"disabled"_s);
3007 writer.writeEndElement();
3010DomColorGroup *DomPalette::takeElementActive()
3012 DomColorGroup *a = m_active;
3014 m_children ^= Active;
3018void DomPalette::setElementActive(DomColorGroup *a)
3021 m_children |= Active;
3025DomColorGroup *DomPalette::takeElementInactive()
3027 DomColorGroup *a = m_inactive;
3028 m_inactive =
nullptr;
3029 m_children ^= Inactive;
3033void DomPalette::setElementInactive(DomColorGroup *a)
3036 m_children |= Inactive;
3040DomColorGroup *DomPalette::takeElementDisabled()
3042 DomColorGroup *a = m_disabled;
3043 m_disabled =
nullptr;
3044 m_children ^= Disabled;
3048void DomPalette::setElementDisabled(DomColorGroup *a)
3051 m_children |= Disabled;
3055void DomPalette::clearElementActive()
3059 m_children &= ~Active;
3062void DomPalette::clearElementInactive()
3065 m_inactive =
nullptr;
3066 m_children &= ~Inactive;
3069void DomPalette::clearElementDisabled()
3072 m_disabled =
nullptr;
3073 m_children &= ~Disabled;
3076DomFont::~DomFont() =
default;
3078void DomFont::read(QXmlStreamReader &reader)
3080 while (!reader.hasError()) {
3081 switch (reader.readNext()) {
3082 case QXmlStreamReader::StartElement : {
3083 const auto tag = reader.name();
3084 if (!tag.compare(u"family"_s, Qt::CaseInsensitive)) {
3085 setElementFamily(reader.readElementText());
3088 if (!tag.compare(u"pointsize"_s, Qt::CaseInsensitive)) {
3089 setElementPointSize(reader.readElementText().toInt());
3092 if (!tag.compare(u"weight"_s, Qt::CaseInsensitive)) {
3093 setElementWeight(reader.readElementText().toInt());
3096 if (!tag.compare(u"italic"_s, Qt::CaseInsensitive)) {
3097 setElementItalic(reader.readElementText() == u"true"_s);
3100 if (!tag.compare(u"bold"_s, Qt::CaseInsensitive)) {
3101 setElementBold(reader.readElementText() == u"true"_s);
3104 if (!tag.compare(u"underline"_s, Qt::CaseInsensitive)) {
3105 setElementUnderline(reader.readElementText() == u"true"_s);
3108 if (!tag.compare(u"strikeout"_s, Qt::CaseInsensitive)) {
3109 setElementStrikeOut(reader.readElementText() == u"true"_s);
3112 if (!tag.compare(u"antialiasing"_s, Qt::CaseInsensitive)) {
3113 setElementAntialiasing(reader.readElementText() == u"true"_s);
3116 if (!tag.compare(u"stylestrategy"_s, Qt::CaseInsensitive)) {
3117 setElementStyleStrategy(reader.readElementText());
3120 if (!tag.compare(u"kerning"_s, Qt::CaseInsensitive)) {
3121 setElementKerning(reader.readElementText() == u"true"_s);
3124 if (!tag.compare(u"hintingpreference"_s, Qt::CaseInsensitive)) {
3125 setElementHintingPreference(reader.readElementText());
3128 if (!tag.compare(u"fontweight"_s, Qt::CaseInsensitive)) {
3129 setElementFontWeight(reader.readElementText());
3132 reader.raiseError(
"Unexpected element "_L1 + tag);
3135 case QXmlStreamReader::EndElement :
3143void DomFont::write(QXmlStreamWriter &writer,
const QString &tagName)
const
3145 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral(
"font") : tagName.toLower());
3147 if (m_children & Family)
3148 writer.writeTextElement(u"family"_s, m_family);
3150 if (m_children & PointSize)
3151 writer.writeTextElement(u"pointsize"_s, QString::number(m_pointSize));
3153 if (m_children & Weight)
3154 writer.writeTextElement(u"weight"_s, QString::number(m_weight));
3156 if (m_children & Italic)
3157 writer.writeTextElement(u"italic"_s, (m_italic ? u"true"_s : u"false"_s));
3159 if (m_children & Bold)
3160 writer.writeTextElement(u"bold"_s, (m_bold ? u"true"_s : u"false"_s));
3162 if (m_children & Underline)
3163 writer.writeTextElement(u"underline"_s, (m_underline ? u"true"_s : u"false"_s));
3165 if (m_children & StrikeOut)
3166 writer.writeTextElement(u"strikeout"_s, (m_strikeOut ? u"true"_s : u"false"_s));
3168 if (m_children & Antialiasing)
3169 writer.writeTextElement(u"antialiasing"_s, (m_antialiasing ? u"true"_s : u"false"_s));
3171 if (m_children & StyleStrategy)
3172 writer.writeTextElement(u"stylestrategy"_s, m_styleStrategy);
3174 if (m_children & Kerning)
3175 writer.writeTextElement(u"kerning"_s, (m_kerning ? u"true"_s : u"false"_s));
3177 if (m_children & HintingPreference)
3178 writer.writeTextElement(u"hintingpreference"_s, m_hintingPreference);
3180 if (m_children & FontWeight)
3181 writer.writeTextElement(u"fontweight"_s, m_fontWeight);
3183 writer.writeEndElement();
3186void DomFont::setElementFamily(
const QString &a)
3188 m_children |= Family;
3192void DomFont::setElementPointSize(
int a)
3194 m_children |= PointSize;
3198void DomFont::setElementWeight(
int a)
3200 m_children |= Weight;
3204void DomFont::setElementItalic(
bool a)
3206 m_children |= Italic;
3210void DomFont::setElementBold(
bool a)
3216void DomFont::setElementUnderline(
bool a)
3218 m_children |= Underline;
3222void DomFont::setElementStrikeOut(
bool a)
3224 m_children |= StrikeOut;
3228void DomFont::setElementAntialiasing(
bool a)
3230 m_children |= Antialiasing;
3234void DomFont::setElementStyleStrategy(
const QString &a)
3236 m_children |= StyleStrategy;
3237 m_styleStrategy = a;
3240void DomFont::setElementKerning(
bool a)
3242 m_children |= Kerning;
3246void DomFont::setElementHintingPreference(
const QString &a)
3248 m_children |= HintingPreference;
3249 m_hintingPreference = a;
3252void DomFont::setElementFontWeight(
const QString &a)
3254 m_children |= FontWeight;
3258void DomFont::clearElementFamily()
3260 m_children &= ~Family;
3263void DomFont::clearElementPointSize()
3265 m_children &= ~PointSize;
3268void DomFont::clearElementWeight()
3270 m_children &= ~Weight;
3273void DomFont::clearElementItalic()
3275 m_children &= ~Italic;
3278void DomFont::clearElementBold()
3280 m_children &= ~Bold;
3283void DomFont::clearElementUnderline()
3285 m_children &= ~Underline;
3288void DomFont::clearElementStrikeOut()
3290 m_children &= ~StrikeOut;
3293void DomFont::clearElementAntialiasing()
3295 m_children &= ~Antialiasing;
3298void DomFont::clearElementStyleStrategy()
3300 m_children &= ~StyleStrategy;
3303void DomFont::clearElementKerning()
3305 m_children &= ~Kerning;
3308void DomFont::clearElementHintingPreference()
3310 m_children &= ~HintingPreference;
3313void DomFont::clearElementFontWeight()
3315 m_children &= ~FontWeight;
3318DomPoint::~DomPoint() =
default;
3320void DomPoint::read(QXmlStreamReader &reader)
3322 while (!reader.hasError()) {
3323 switch (reader.readNext()) {
3324 case QXmlStreamReader::StartElement : {
3325 const auto tag = reader.name();
3326 if (!tag.compare(u"x"_s, Qt::CaseInsensitive)) {
3327 setElementX(reader.readElementText().toInt());
3330 if (!tag.compare(u"y"_s, Qt::CaseInsensitive)) {
3331 setElementY(reader.readElementText().toInt());
3334 reader.raiseError(
"Unexpected element "_L1 + tag);
3337 case QXmlStreamReader::EndElement :
3345void DomPoint::write(QXmlStreamWriter &writer,
const QString &tagName)
const
3347 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral(
"point") : tagName.toLower());
3350 writer.writeTextElement(u"x"_s, QString::number(m_x));
3353 writer.writeTextElement(u"y"_s, QString::number(m_y));
3355 writer.writeEndElement();
3358void DomPoint::setElementX(
int a)
3364void DomPoint::setElementY(
int a)
3370void DomPoint::clearElementX()
3375void DomPoint::clearElementY()
3380DomRect::~DomRect() =
default;
3382void DomRect::read(QXmlStreamReader &reader)
3384 while (!reader.hasError()) {
3385 switch (reader.readNext()) {
3386 case QXmlStreamReader::StartElement : {
3387 const auto tag = reader.name();
3388 if (!tag.compare(u"x"_s, Qt::CaseInsensitive)) {
3389 setElementX(reader.readElementText().toInt());
3392 if (!tag.compare(u"y"_s, Qt::CaseInsensitive)) {
3393 setElementY(reader.readElementText().toInt());
3396 if (!tag.compare(u"width"_s, Qt::CaseInsensitive)) {
3397 setElementWidth(reader.readElementText().toInt());
3400 if (!tag.compare(u"height"_s, Qt::CaseInsensitive)) {
3401 setElementHeight(reader.readElementText().toInt());
3404 reader.raiseError(
"Unexpected element "_L1 + tag);
3407 case QXmlStreamReader::EndElement :
3415void DomRect::write(QXmlStreamWriter &writer,
const QString &tagName)
const
3417 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral(
"rect") : tagName.toLower());
3420 writer.writeTextElement(u"x"_s, QString::number(m_x));
3423 writer.writeTextElement(u"y"_s, QString::number(m_y));
3425 if (m_children & Width)
3426 writer.writeTextElement(u"width"_s, QString::number(m_width));
3428 if (m_children & Height)
3429 writer.writeTextElement(u"height"_s, QString::number(m_height));
3431 writer.writeEndElement();
3434void DomRect::setElementX(
int a)
3440void DomRect::setElementY(
int a)
3446void DomRect::setElementWidth(
int a)
3448 m_children |= Width;
3452void DomRect::setElementHeight(
int a)
3454 m_children |= Height;
3458void DomRect::clearElementX()
3463void DomRect::clearElementY()
3468void DomRect::clearElementWidth()
3470 m_children &= ~Width;
3473void DomRect::clearElementHeight()
3475 m_children &= ~Height;
3478DomLocale::~DomLocale() =
default;
3480void DomLocale::read(QXmlStreamReader &reader)
3482 const QXmlStreamAttributes &attributes = reader.attributes();
3483 for (
const QXmlStreamAttribute &attribute : attributes) {
3484 const auto name = attribute.name();
3485 if (name == u"language"_s) {
3486 setAttributeLanguage(attribute.value().toString());
3489 if (name == u"country"_s) {
3490 setAttributeCountry(attribute.value().toString());
3493 reader.raiseError(
"Unexpected attribute "_L1 + name);
3496 while (!reader.hasError()) {
3497 switch (reader.readNext()) {
3498 case QXmlStreamReader::StartElement : {
3499 const auto tag = reader.name();
3500 reader.raiseError(
"Unexpected element "_L1 + tag);
3503 case QXmlStreamReader::EndElement :
3511void DomLocale::write(QXmlStreamWriter &writer,
const QString &tagName)
const
3513 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral(
"locale") : tagName.toLower());
3515 if (hasAttributeLanguage())
3516 writer.writeAttribute(u"language"_s, attributeLanguage());
3518 if (hasAttributeCountry())
3519 writer.writeAttribute(u"country"_s, attributeCountry());
3521 writer.writeEndElement();
3524DomSizePolicy::~DomSizePolicy() =
default;
3526void DomSizePolicy::read(QXmlStreamReader &reader)
3528 const QXmlStreamAttributes &attributes = reader.attributes();
3529 for (
const QXmlStreamAttribute &attribute : attributes) {
3530 const auto name = attribute.name();
3531 if (name == u"hsizetype"_s) {
3532 setAttributeHSizeType(attribute.value().toString());
3535 if (name == u"vsizetype"_s) {
3536 setAttributeVSizeType(attribute.value().toString());
3539 reader.raiseError(
"Unexpected attribute "_L1 + name);
3542 while (!reader.hasError()) {
3543 switch (reader.readNext()) {
3544 case QXmlStreamReader::StartElement : {
3545 const auto tag = reader.name();
3546 if (!tag.compare(u"hsizetype"_s, Qt::CaseInsensitive)) {
3547 setElementHSizeType(reader.readElementText().toInt());
3550 if (!tag.compare(u"vsizetype"_s, Qt::CaseInsensitive)) {
3551 setElementVSizeType(reader.readElementText().toInt());
3554 if (!tag.compare(u"horstretch"_s, Qt::CaseInsensitive)) {
3555 setElementHorStretch(reader.readElementText().toInt());
3558 if (!tag.compare(u"verstretch"_s, Qt::CaseInsensitive)) {
3559 setElementVerStretch(reader.readElementText().toInt());
3562 reader.raiseError(
"Unexpected element "_L1 + tag);
3565 case QXmlStreamReader::EndElement :
3573void DomSizePolicy::write(QXmlStreamWriter &writer,
const QString &tagName)
const
3575 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral(
"sizepolicy") : tagName.toLower());
3577 if (hasAttributeHSizeType())
3578 writer.writeAttribute(u"hsizetype"_s, attributeHSizeType());
3580 if (hasAttributeVSizeType())
3581 writer.writeAttribute(u"vsizetype"_s, attributeVSizeType());
3583 if (m_children & HSizeType)
3584 writer.writeTextElement(u"hsizetype"_s, QString::number(m_hSizeType));
3586 if (m_children & VSizeType)
3587 writer.writeTextElement(u"vsizetype"_s, QString::number(m_vSizeType));
3589 if (m_children & HorStretch)
3590 writer.writeTextElement(u"horstretch"_s, QString::number(m_horStretch));
3592 if (m_children & VerStretch)
3593 writer.writeTextElement(u"verstretch"_s, QString::number(m_verStretch));
3595 writer.writeEndElement();
3598void DomSizePolicy::setElementHSizeType(
int a)
3600 m_children |= HSizeType;
3604void DomSizePolicy::setElementVSizeType(
int a)
3606 m_children |= VSizeType;
3610void DomSizePolicy::setElementHorStretch(
int a)
3612 m_children |= HorStretch;
3616void DomSizePolicy::setElementVerStretch(
int a)
3618 m_children |= VerStretch;
3622void DomSizePolicy::clearElementHSizeType()
3624 m_children &= ~HSizeType;
3627void DomSizePolicy::clearElementVSizeType()
3629 m_children &= ~VSizeType;
3632void DomSizePolicy::clearElementHorStretch()
3634 m_children &= ~HorStretch;
3637void DomSizePolicy::clearElementVerStretch()
3639 m_children &= ~VerStretch;
3642DomSize::~DomSize() =
default;
3644void DomSize::read(QXmlStreamReader &reader)
3646 while (!reader.hasError()) {
3647 switch (reader.readNext()) {
3648 case QXmlStreamReader::StartElement : {
3649 const auto tag = reader.name();
3650 if (!tag.compare(u"width"_s, Qt::CaseInsensitive)) {
3651 setElementWidth(reader.readElementText().toInt());
3654 if (!tag.compare(u"height"_s, Qt::CaseInsensitive)) {
3655 setElementHeight(reader.readElementText().toInt());
3658 reader.raiseError(
"Unexpected element "_L1 + tag);
3661 case QXmlStreamReader::EndElement :
3669void DomSize::write(QXmlStreamWriter &writer,
const QString &tagName)
const
3671 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral(
"size") : tagName.toLower());
3673 if (m_children & Width)
3674 writer.writeTextElement(u"width"_s, QString::number(m_width));
3676 if (m_children & Height)
3677 writer.writeTextElement(u"height"_s, QString::number(m_height));
3679 writer.writeEndElement();
3682void DomSize::setElementWidth(
int a)
3684 m_children |= Width;
3688void DomSize::setElementHeight(
int a)
3690 m_children |= Height;
3694void DomSize::clearElementWidth()
3696 m_children &= ~Width;
3699void DomSize::clearElementHeight()
3701 m_children &= ~Height;
3704DomDate::~DomDate() =
default;
3706void DomDate::read(QXmlStreamReader &reader)
3708 while (!reader.hasError()) {
3709 switch (reader.readNext()) {
3710 case QXmlStreamReader::StartElement : {
3711 const auto tag = reader.name();
3712 if (!tag.compare(u"year"_s, Qt::CaseInsensitive)) {
3713 setElementYear(reader.readElementText().toInt());
3716 if (!tag.compare(u"month"_s, Qt::CaseInsensitive)) {
3717 setElementMonth(reader.readElementText().toInt());
3720 if (!tag.compare(u"day"_s, Qt::CaseInsensitive)) {
3721 setElementDay(reader.readElementText().toInt());
3724 reader.raiseError(
"Unexpected element "_L1 + tag);
3727 case QXmlStreamReader::EndElement :
3735void DomDate::write(QXmlStreamWriter &writer,
const QString &tagName)
const
3737 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral(
"date") : tagName.toLower());
3739 if (m_children & Year)
3740 writer.writeTextElement(u"year"_s, QString::number(m_year));
3742 if (m_children & Month)
3743 writer.writeTextElement(u"month"_s, QString::number(m_month));
3745 if (m_children & Day)
3746 writer.writeTextElement(u"day"_s, QString::number(m_day));
3748 writer.writeEndElement();
3751void DomDate::setElementYear(
int a)
3757void DomDate::setElementMonth(
int a)
3759 m_children |= Month;
3763void DomDate::setElementDay(
int a)
3769void DomDate::clearElementYear()
3771 m_children &= ~Year;
3774void DomDate::clearElementMonth()
3776 m_children &= ~Month;
3779void DomDate::clearElementDay()
3784DomTime::~DomTime() =
default;
3786void DomTime::read(QXmlStreamReader &reader)
3788 while (!reader.hasError()) {
3789 switch (reader.readNext()) {
3790 case QXmlStreamReader::StartElement : {
3791 const auto tag = reader.name();
3792 if (!tag.compare(u"hour"_s, Qt::CaseInsensitive)) {
3793 setElementHour(reader.readElementText().toInt());
3796 if (!tag.compare(u"minute"_s, Qt::CaseInsensitive)) {
3797 setElementMinute(reader.readElementText().toInt());
3800 if (!tag.compare(u"second"_s, Qt::CaseInsensitive)) {
3801 setElementSecond(reader.readElementText().toInt());
3804 reader.raiseError(
"Unexpected element "_L1 + tag);
3807 case QXmlStreamReader::EndElement :
3815void DomTime::write(QXmlStreamWriter &writer,
const QString &tagName)
const
3817 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral(
"time") : tagName.toLower());
3819 if (m_children & Hour)
3820 writer.writeTextElement(u"hour"_s, QString::number(m_hour));
3822 if (m_children & Minute)
3823 writer.writeTextElement(u"minute"_s, QString::number(m_minute));
3825 if (m_children & Second)
3826 writer.writeTextElement(u"second"_s, QString::number(m_second));
3828 writer.writeEndElement();
3831void DomTime::setElementHour(
int a)
3837void DomTime::setElementMinute(
int a)
3839 m_children |= Minute;
3843void DomTime::setElementSecond(
int a)
3845 m_children |= Second;
3849void DomTime::clearElementHour()
3851 m_children &= ~Hour;
3854void DomTime::clearElementMinute()
3856 m_children &= ~Minute;
3859void DomTime::clearElementSecond()
3861 m_children &= ~Second;
3864DomDateTime::~DomDateTime() =
default;
3866void DomDateTime::read(QXmlStreamReader &reader)
3868 while (!reader.hasError()) {
3869 switch (reader.readNext()) {
3870 case QXmlStreamReader::StartElement : {
3871 const auto tag = reader.name();
3872 if (!tag.compare(u"hour"_s, Qt::CaseInsensitive)) {
3873 setElementHour(reader.readElementText().toInt());
3876 if (!tag.compare(u"minute"_s, Qt::CaseInsensitive)) {
3877 setElementMinute(reader.readElementText().toInt());
3880 if (!tag.compare(u"second"_s, Qt::CaseInsensitive)) {
3881 setElementSecond(reader.readElementText().toInt());
3884 if (!tag.compare(u"year"_s, Qt::CaseInsensitive)) {
3885 setElementYear(reader.readElementText().toInt());
3888 if (!tag.compare(u"month"_s, Qt::CaseInsensitive)) {
3889 setElementMonth(reader.readElementText().toInt());
3892 if (!tag.compare(u"day"_s, Qt::CaseInsensitive)) {
3893 setElementDay(reader.readElementText().toInt());
3896 reader.raiseError(
"Unexpected element "_L1 + tag);
3899 case QXmlStreamReader::EndElement :
3907void DomDateTime::write(QXmlStreamWriter &writer,
const QString &tagName)
const
3909 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral(
"datetime") : tagName.toLower());
3911 if (m_children & Hour)
3912 writer.writeTextElement(u"hour"_s, QString::number(m_hour));
3914 if (m_children & Minute)
3915 writer.writeTextElement(u"minute"_s, QString::number(m_minute));
3917 if (m_children & Second)
3918 writer.writeTextElement(u"second"_s, QString::number(m_second));
3920 if (m_children & Year)
3921 writer.writeTextElement(u"year"_s, QString::number(m_year));
3923 if (m_children & Month)
3924 writer.writeTextElement(u"month"_s, QString::number(m_month));
3926 if (m_children & Day)
3927 writer.writeTextElement(u"day"_s, QString::number(m_day));
3929 writer.writeEndElement();
3932void DomDateTime::setElementHour(
int a)
3938void DomDateTime::setElementMinute(
int a)
3940 m_children |= Minute;
3944void DomDateTime::setElementSecond(
int a)
3946 m_children |= Second;
3950void DomDateTime::setElementYear(
int a)
3956void DomDateTime::setElementMonth(
int a)
3958 m_children |= Month;
3962void DomDateTime::setElementDay(
int a)
3968void DomDateTime::clearElementHour()
3970 m_children &= ~Hour;
3973void DomDateTime::clearElementMinute()
3975 m_children &= ~Minute;
3978void DomDateTime::clearElementSecond()
3980 m_children &= ~Second;
3983void DomDateTime::clearElementYear()
3985 m_children &= ~Year;
3988void DomDateTime::clearElementMonth()
3990 m_children &= ~Month;
3993void DomDateTime::clearElementDay()
3998DomStringList::~DomStringList()
4003void DomStringList::read(QXmlStreamReader &reader)
4005 const QXmlStreamAttributes &attributes = reader.attributes();
4006 for (
const QXmlStreamAttribute &attribute : attributes) {
4007 const auto name = attribute.name();
4008 if (name == u"notr"_s) {
4009 setAttributeNotr(attribute.value().toString());
4012 if (name == u"comment"_s) {
4013 setAttributeComment(attribute.value().toString());
4016 if (name == u"extracomment"_s) {
4017 setAttributeExtraComment(attribute.value().toString());
4020 if (name == u"id"_s) {
4021 setAttributeId(attribute.value().toString());
4024 reader.raiseError(
"Unexpected attribute "_L1 + name);
4027 while (!reader.hasError()) {
4028 switch (reader.readNext()) {
4029 case QXmlStreamReader::StartElement : {
4030 const auto tag = reader.name();
4031 if (!tag.compare(u"string"_s, Qt::CaseInsensitive)) {
4032 m_string.append(reader.readElementText());
4035 reader.raiseError(
"Unexpected element "_L1 + tag);
4038 case QXmlStreamReader::EndElement :
4046void DomStringList::write(QXmlStreamWriter &writer,
const QString &tagName)
const
4048 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral(
"stringlist") : tagName.toLower());
4050 if (hasAttributeNotr())
4051 writer.writeAttribute(u"notr"_s, attributeNotr());
4053 if (hasAttributeComment())
4054 writer.writeAttribute(u"comment"_s, attributeComment());
4056 if (hasAttributeExtraComment())
4057 writer.writeAttribute(u"extracomment"_s, attributeExtraComment());
4059 if (hasAttributeId())
4060 writer.writeAttribute(u"id"_s, attributeId());
4062 for (
const QString &v : m_string)
4063 writer.writeTextElement(u"string"_s, v);
4065 writer.writeEndElement();
4068void DomStringList::setElementString(
const QStringList &a)
4070 m_children |= String;
4074DomResourcePixmap::~DomResourcePixmap() =
default;
4076void DomResourcePixmap::read(QXmlStreamReader &reader)
4078 const QXmlStreamAttributes &attributes = reader.attributes();
4079 for (
const QXmlStreamAttribute &attribute : attributes) {
4080 const auto name = attribute.name();
4081 if (name == u"resource"_s) {
4082 setAttributeResource(attribute.value().toString());
4085 if (name == u"alias"_s) {
4086 setAttributeAlias(attribute.value().toString());
4089 reader.raiseError(
"Unexpected attribute "_L1 + name);
4092 while (!reader.hasError()) {
4093 switch (reader.readNext()) {
4094 case QXmlStreamReader::StartElement : {
4095 const auto tag = reader.name();
4096 reader.raiseError(
"Unexpected element "_L1 + tag);
4099 case QXmlStreamReader::EndElement :
4101 case QXmlStreamReader::Characters :
4102 if (!reader.isWhitespace())
4103 m_text.append(reader.text().toString());
4111void DomResourcePixmap::write(QXmlStreamWriter &writer,
const QString &tagName)
const
4113 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral(
"resourcepixmap") : tagName.toLower());
4115 if (hasAttributeResource())
4116 writer.writeAttribute(u"resource"_s, attributeResource());
4118 if (hasAttributeAlias())
4119 writer.writeAttribute(u"alias"_s, attributeAlias());
4121 if (!m_text.isEmpty())
4122 writer.writeCharacters(m_text);
4124 writer.writeEndElement();
4127DomResourceIcon::~DomResourceIcon()
4131 delete m_disabledOff;
4132 delete m_disabledOn;
4135 delete m_selectedOff;
4136 delete m_selectedOn;
4139void DomResourceIcon::read(QXmlStreamReader &reader)
4141 const QXmlStreamAttributes &attributes = reader.attributes();
4142 for (
const QXmlStreamAttribute &attribute : attributes) {
4143 const auto name = attribute.name();
4144 if (name == u"theme"_s) {
4145 setAttributeTheme(attribute.value().toString());
4148 if (name == u"resource"_s) {
4149 setAttributeResource(attribute.value().toString());
4152 reader.raiseError(
"Unexpected attribute "_L1 + name);
4155 while (!reader.hasError()) {
4156 switch (reader.readNext()) {
4157 case QXmlStreamReader::StartElement : {
4158 const auto tag = reader.name();
4159 if (!tag.compare(u"normaloff"_s, Qt::CaseInsensitive)) {
4160 auto *v =
new DomResourcePixmap();
4162 setElementNormalOff(v);
4165 if (!tag.compare(u"normalon"_s, Qt::CaseInsensitive)) {
4166 auto *v =
new DomResourcePixmap();
4168 setElementNormalOn(v);
4171 if (!tag.compare(u"disabledoff"_s, Qt::CaseInsensitive)) {
4172 auto *v =
new DomResourcePixmap();
4174 setElementDisabledOff(v);
4177 if (!tag.compare(u"disabledon"_s, Qt::CaseInsensitive)) {
4178 auto *v =
new DomResourcePixmap();
4180 setElementDisabledOn(v);
4183 if (!tag.compare(u"activeoff"_s, Qt::CaseInsensitive)) {
4184 auto *v =
new DomResourcePixmap();
4186 setElementActiveOff(v);
4189 if (!tag.compare(u"activeon"_s, Qt::CaseInsensitive)) {
4190 auto *v =
new DomResourcePixmap();
4192 setElementActiveOn(v);
4195 if (!tag.compare(u"selectedoff"_s, Qt::CaseInsensitive)) {
4196 auto *v =
new DomResourcePixmap();
4198 setElementSelectedOff(v);
4201 if (!tag.compare(u"selectedon"_s, Qt::CaseInsensitive)) {
4202 auto *v =
new DomResourcePixmap();
4204 setElementSelectedOn(v);
4207 reader.raiseError(
"Unexpected element "_L1 + tag);
4210 case QXmlStreamReader::EndElement :
4212 case QXmlStreamReader::Characters :
4213 if (!reader.isWhitespace())
4214 m_text.append(reader.text().toString());
4222void DomResourceIcon::write(QXmlStreamWriter &writer,
const QString &tagName)
const
4224 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral(
"resourceicon") : tagName.toLower());
4226 if (hasAttributeTheme())
4227 writer.writeAttribute(u"theme"_s, attributeTheme());
4229 if (hasAttributeResource())
4230 writer.writeAttribute(u"resource"_s, attributeResource());
4232 if (m_children & NormalOff)
4233 m_normalOff->write(writer, u"normaloff"_s);
4235 if (m_children & NormalOn)
4236 m_normalOn->write(writer, u"normalon"_s);
4238 if (m_children & DisabledOff)
4239 m_disabledOff->write(writer, u"disabledoff"_s);
4241 if (m_children & DisabledOn)
4242 m_disabledOn->write(writer, u"disabledon"_s);
4244 if (m_children & ActiveOff)
4245 m_activeOff->write(writer, u"activeoff"_s);
4247 if (m_children & ActiveOn)
4248 m_activeOn->write(writer, u"activeon"_s);
4250 if (m_children & SelectedOff)
4251 m_selectedOff->write(writer, u"selectedoff"_s);
4253 if (m_children & SelectedOn)
4254 m_selectedOn->write(writer, u"selectedon"_s);
4256 if (!m_text.isEmpty())
4257 writer.writeCharacters(m_text);
4259 writer.writeEndElement();
4262DomResourcePixmap *DomResourceIcon::takeElementNormalOff()
4264 DomResourcePixmap *a = m_normalOff;
4265 m_normalOff =
nullptr;
4266 m_children ^= NormalOff;
4270void DomResourceIcon::setElementNormalOff(DomResourcePixmap *a)
4273 m_children |= NormalOff;
4277DomResourcePixmap *DomResourceIcon::takeElementNormalOn()
4279 DomResourcePixmap *a = m_normalOn;
4280 m_normalOn =
nullptr;
4281 m_children ^= NormalOn;
4285void DomResourceIcon::setElementNormalOn(DomResourcePixmap *a)
4288 m_children |= NormalOn;
4292DomResourcePixmap *DomResourceIcon::takeElementDisabledOff()
4294 DomResourcePixmap *a = m_disabledOff;
4295 m_disabledOff =
nullptr;
4296 m_children ^= DisabledOff;
4300void DomResourceIcon::setElementDisabledOff(DomResourcePixmap *a)
4302 delete m_disabledOff;
4303 m_children |= DisabledOff;
4307DomResourcePixmap *DomResourceIcon::takeElementDisabledOn()
4309 DomResourcePixmap *a = m_disabledOn;
4310 m_disabledOn =
nullptr;
4311 m_children ^= DisabledOn;
4315void DomResourceIcon::setElementDisabledOn(DomResourcePixmap *a)
4317 delete m_disabledOn;
4318 m_children |= DisabledOn;
4322DomResourcePixmap *DomResourceIcon::takeElementActiveOff()
4324 DomResourcePixmap *a = m_activeOff;
4325 m_activeOff =
nullptr;
4326 m_children ^= ActiveOff;
4330void DomResourceIcon::setElementActiveOff(DomResourcePixmap *a)
4333 m_children |= ActiveOff;
4337DomResourcePixmap *DomResourceIcon::takeElementActiveOn()
4339 DomResourcePixmap *a = m_activeOn;
4340 m_activeOn =
nullptr;
4341 m_children ^= ActiveOn;
4345void DomResourceIcon::setElementActiveOn(DomResourcePixmap *a)
4348 m_children |= ActiveOn;
4352DomResourcePixmap *DomResourceIcon::takeElementSelectedOff()
4354 DomResourcePixmap *a = m_selectedOff;
4355 m_selectedOff =
nullptr;
4356 m_children ^= SelectedOff;
4360void DomResourceIcon::setElementSelectedOff(DomResourcePixmap *a)
4362 delete m_selectedOff;
4363 m_children |= SelectedOff;
4367DomResourcePixmap *DomResourceIcon::takeElementSelectedOn()
4369 DomResourcePixmap *a = m_selectedOn;
4370 m_selectedOn =
nullptr;
4371 m_children ^= SelectedOn;
4375void DomResourceIcon::setElementSelectedOn(DomResourcePixmap *a)
4377 delete m_selectedOn;
4378 m_children |= SelectedOn;
4382void DomResourceIcon::clearElementNormalOff()
4385 m_normalOff =
nullptr;
4386 m_children &= ~NormalOff;
4389void DomResourceIcon::clearElementNormalOn()
4392 m_normalOn =
nullptr;
4393 m_children &= ~NormalOn;
4396void DomResourceIcon::clearElementDisabledOff()
4398 delete m_disabledOff;
4399 m_disabledOff =
nullptr;
4400 m_children &= ~DisabledOff;
4403void DomResourceIcon::clearElementDisabledOn()
4405 delete m_disabledOn;
4406 m_disabledOn =
nullptr;
4407 m_children &= ~DisabledOn;
4410void DomResourceIcon::clearElementActiveOff()
4413 m_activeOff =
nullptr;
4414 m_children &= ~ActiveOff;
4417void DomResourceIcon::clearElementActiveOn()
4420 m_activeOn =
nullptr;
4421 m_children &= ~ActiveOn;
4424void DomResourceIcon::clearElementSelectedOff()
4426 delete m_selectedOff;
4427 m_selectedOff =
nullptr;
4428 m_children &= ~SelectedOff;
4431void DomResourceIcon::clearElementSelectedOn()
4433 delete m_selectedOn;
4434 m_selectedOn =
nullptr;
4435 m_children &= ~SelectedOn;
4438DomString::~DomString() =
default;
4440void DomString::read(QXmlStreamReader &reader)
4442 const QXmlStreamAttributes &attributes = reader.attributes();
4443 for (
const QXmlStreamAttribute &attribute : attributes) {
4444 const auto name = attribute.name();
4445 if (name == u"notr"_s) {
4446 setAttributeNotr(attribute.value().toString());
4449 if (name == u"comment"_s) {
4450 setAttributeComment(attribute.value().toString());
4453 if (name == u"extracomment"_s) {
4454 setAttributeExtraComment(attribute.value().toString());
4457 if (name == u"id"_s) {
4458 setAttributeId(attribute.value().toString());
4461 reader.raiseError(
"Unexpected attribute "_L1 + name);
4464 while (!reader.hasError()) {
4465 switch (reader.readNext()) {
4466 case QXmlStreamReader::StartElement : {
4467 const auto tag = reader.name();
4468 reader.raiseError(
"Unexpected element "_L1 + tag);
4471 case QXmlStreamReader::EndElement :
4473 case QXmlStreamReader::Characters :
4474 if (!reader.isWhitespace())
4475 m_text.append(reader.text().toString());
4483void DomString::write(QXmlStreamWriter &writer,
const QString &tagName)
const
4485 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral(
"string") : tagName.toLower());
4487 if (hasAttributeNotr())
4488 writer.writeAttribute(u"notr"_s, attributeNotr());
4490 if (hasAttributeComment())
4491 writer.writeAttribute(u"comment"_s, attributeComment());
4493 if (hasAttributeExtraComment())
4494 writer.writeAttribute(u"extracomment"_s, attributeExtraComment());
4496 if (hasAttributeId())
4497 writer.writeAttribute(u"id"_s, attributeId());
4499 if (!m_text.isEmpty())
4500 writer.writeCharacters(m_text);
4502 writer.writeEndElement();
4505DomPointF::~DomPointF() =
default;
4507void DomPointF::read(QXmlStreamReader &reader)
4509 while (!reader.hasError()) {
4510 switch (reader.readNext()) {
4511 case QXmlStreamReader::StartElement : {
4512 const auto tag = reader.name();
4513 if (!tag.compare(u"x"_s, Qt::CaseInsensitive)) {
4514 setElementX(reader.readElementText().toDouble());
4517 if (!tag.compare(u"y"_s, Qt::CaseInsensitive)) {
4518 setElementY(reader.readElementText().toDouble());
4521 reader.raiseError(
"Unexpected element "_L1 + tag);
4524 case QXmlStreamReader::EndElement :
4532void DomPointF::write(QXmlStreamWriter &writer,
const QString &tagName)
const
4534 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral(
"pointf") : tagName.toLower());
4537 writer.writeTextElement(u"x"_s, QString::number(m_x,
'f', 15));
4540 writer.writeTextElement(u"y"_s, QString::number(m_y,
'f', 15));
4542 writer.writeEndElement();
4545void DomPointF::setElementX(
double a)
4551void DomPointF::setElementY(
double a)
4557void DomPointF::clearElementX()
4562void DomPointF::clearElementY()
4567DomRectF::~DomRectF() =
default;
4569void DomRectF::read(QXmlStreamReader &reader)
4571 while (!reader.hasError()) {
4572 switch (reader.readNext()) {
4573 case QXmlStreamReader::StartElement : {
4574 const auto tag = reader.name();
4575 if (!tag.compare(u"x"_s, Qt::CaseInsensitive)) {
4576 setElementX(reader.readElementText().toDouble());
4579 if (!tag.compare(u"y"_s, Qt::CaseInsensitive)) {
4580 setElementY(reader.readElementText().toDouble());
4583 if (!tag.compare(u"width"_s, Qt::CaseInsensitive)) {
4584 setElementWidth(reader.readElementText().toDouble());
4587 if (!tag.compare(u"height"_s, Qt::CaseInsensitive)) {
4588 setElementHeight(reader.readElementText().toDouble());
4591 reader.raiseError(
"Unexpected element "_L1 + tag);
4594 case QXmlStreamReader::EndElement :
4602void DomRectF::write(QXmlStreamWriter &writer,
const QString &tagName)
const
4604 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral(
"rectf") : tagName.toLower());
4607 writer.writeTextElement(u"x"_s, QString::number(m_x,
'f', 15));
4610 writer.writeTextElement(u"y"_s, QString::number(m_y,
'f', 15));
4612 if (m_children & Width)
4613 writer.writeTextElement(u"width"_s, QString::number(m_width,
'f', 15));
4615 if (m_children & Height)
4616 writer.writeTextElement(u"height"_s, QString::number(m_height,
'f', 15));
4618 writer.writeEndElement();
4621void DomRectF::setElementX(
double a)
4627void DomRectF::setElementY(
double a)
4633void DomRectF::setElementWidth(
double a)
4635 m_children |= Width;
4639void DomRectF::setElementHeight(
double a)
4641 m_children |= Height;
4645void DomRectF::clearElementX()
4650void DomRectF::clearElementY()
4655void DomRectF::clearElementWidth()
4657 m_children &= ~Width;
4660void DomRectF::clearElementHeight()
4662 m_children &= ~Height;
4665DomSizeF::~DomSizeF() =
default;
4667void DomSizeF::read(QXmlStreamReader &reader)
4669 while (!reader.hasError()) {
4670 switch (reader.readNext()) {
4671 case QXmlStreamReader::StartElement : {
4672 const auto tag = reader.name();
4673 if (!tag.compare(u"width"_s, Qt::CaseInsensitive)) {
4674 setElementWidth(reader.readElementText().toDouble());
4677 if (!tag.compare(u"height"_s, Qt::CaseInsensitive)) {
4678 setElementHeight(reader.readElementText().toDouble());
4681 reader.raiseError(
"Unexpected element "_L1 + tag);
4684 case QXmlStreamReader::EndElement :
4692void DomSizeF::write(QXmlStreamWriter &writer,
const QString &tagName)
const
4694 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral(
"sizef") : tagName.toLower());
4696 if (m_children & Width)
4697 writer.writeTextElement(u"width"_s, QString::number(m_width,
'f', 15));
4699 if (m_children & Height)
4700 writer.writeTextElement(u"height"_s, QString::number(m_height,
'f', 15));
4702 writer.writeEndElement();
4705void DomSizeF::setElementWidth(
double a)
4707 m_children |= Width;
4711void DomSizeF::setElementHeight(
double a)
4713 m_children |= Height;
4717void DomSizeF::clearElementWidth()
4719 m_children &= ~Width;
4722void DomSizeF::clearElementHeight()
4724 m_children &= ~Height;
4727DomChar::~DomChar() =
default;
4729void DomChar::read(QXmlStreamReader &reader)
4731 while (!reader.hasError()) {
4732 switch (reader.readNext()) {
4733 case QXmlStreamReader::StartElement : {
4734 const auto tag = reader.name();
4735 if (!tag.compare(u"unicode"_s, Qt::CaseInsensitive)) {
4736 setElementUnicode(reader.readElementText().toInt());
4739 reader.raiseError(
"Unexpected element "_L1 + tag);
4742 case QXmlStreamReader::EndElement :
4750void DomChar::write(QXmlStreamWriter &writer,
const QString &tagName)
const
4752 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral(
"char") : tagName.toLower());
4754 if (m_children & Unicode)
4755 writer.writeTextElement(u"unicode"_s, QString::number(m_unicode));
4757 writer.writeEndElement();
4760void DomChar::setElementUnicode(
int a)
4762 m_children |= Unicode;
4766void DomChar::clearElementUnicode()
4768 m_children &= ~Unicode;
4776void DomUrl::read(QXmlStreamReader &reader)
4778 while (!reader.hasError()) {
4779 switch (reader.readNext()) {
4780 case QXmlStreamReader::StartElement : {
4781 const auto tag = reader.name();
4782 if (!tag.compare(u"string"_s, Qt::CaseInsensitive)) {
4783 auto *v =
new DomString();
4785 setElementString(v);
4788 reader.raiseError(
"Unexpected element "_L1 + tag);
4791 case QXmlStreamReader::EndElement :
4799void DomUrl::write(QXmlStreamWriter &writer,
const QString &tagName)
const
4801 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral(
"url") : tagName.toLower());
4803 if (m_children & String)
4804 m_string->write(writer, u"string"_s);
4806 writer.writeEndElement();
4809DomString *DomUrl::takeElementString()
4811 DomString *a = m_string;
4813 m_children ^= String;
4817void DomUrl::setElementString(DomString *a)
4820 m_children |= String;
4824void DomUrl::clearElementString()
4828 m_children &= ~String;
4831DomProperty::~DomProperty()
4841 delete m_sizePolicy;
4844 delete m_stringList;
4856void DomProperty::clear()
4866 delete m_sizePolicy;
4869 delete m_stringList;
4885 m_iconSet =
nullptr;
4887 m_palette =
nullptr;
4891 m_sizePolicy =
nullptr;
4894 m_stringList =
nullptr;
4900 m_dateTime =
nullptr;
4912void DomProperty::read(QXmlStreamReader &reader)
4914 const QXmlStreamAttributes &attributes = reader.attributes();
4915 for (
const QXmlStreamAttribute &attribute : attributes) {
4916 const auto name = attribute.name();
4917 if (name == u"name"_s) {
4918 setAttributeName(attribute.value().toString());
4921 if (name == u"stdset"_s) {
4922 setAttributeStdset(attribute.value().toInt());
4925 reader.raiseError(
"Unexpected attribute "_L1 + name);
4928 while (!reader.hasError()) {
4929 switch (reader.readNext()) {
4930 case QXmlStreamReader::StartElement : {
4931 const auto tag = reader.name();
4932 if (!tag.compare(u"bool"_s, Qt::CaseInsensitive)) {
4933 setElementBool(reader.readElementText());
4936 if (!tag.compare(u"color"_s, Qt::CaseInsensitive)) {
4937 auto *v =
new DomColor();
4942 if (!tag.compare(u"cstring"_s, Qt::CaseInsensitive)) {
4943 setElementCstring(reader.readElementText());
4946 if (!tag.compare(u"cursor"_s, Qt::CaseInsensitive)) {
4947 setElementCursor(reader.readElementText().toInt());
4950 if (!tag.compare(u"cursorshape"_s, Qt::CaseInsensitive)) {
4951 setElementCursorShape(reader.readElementText());
4954 if (!tag.compare(u"enum"_s, Qt::CaseInsensitive)) {
4955 setElementEnum(reader.readElementText());
4958 if (!tag.compare(u"font"_s, Qt::CaseInsensitive)) {
4959 auto *v =
new DomFont();
4964 if (!tag.compare(u"iconset"_s, Qt::CaseInsensitive)) {
4965 auto *v =
new DomResourceIcon();
4967 setElementIconSet(v);
4970 if (!tag.compare(u"pixmap"_s, Qt::CaseInsensitive)) {
4971 auto *v =
new DomResourcePixmap();
4973 setElementPixmap(v);
4976 if (!tag.compare(u"palette"_s, Qt::CaseInsensitive)) {
4977 auto *v =
new DomPalette();
4979 setElementPalette(v);
4982 if (!tag.compare(u"point"_s, Qt::CaseInsensitive)) {
4983 auto *v =
new DomPoint();
4988 if (!tag.compare(u"rect"_s, Qt::CaseInsensitive)) {
4989 auto *v =
new DomRect();
4994 if (!tag.compare(u"set"_s, Qt::CaseInsensitive)) {
4995 setElementSet(reader.readElementText());
4998 if (!tag.compare(u"locale"_s, Qt::CaseInsensitive)) {
4999 auto *v =
new DomLocale();
5001 setElementLocale(v);
5004 if (!tag.compare(u"sizepolicy"_s, Qt::CaseInsensitive)) {
5005 auto *v =
new DomSizePolicy();
5007 setElementSizePolicy(v);
5010 if (!tag.compare(u"size"_s, Qt::CaseInsensitive)) {
5011 auto *v =
new DomSize();
5016 if (!tag.compare(u"string"_s, Qt::CaseInsensitive)) {
5017 auto *v =
new DomString();
5019 setElementString(v);
5022 if (!tag.compare(u"stringlist"_s, Qt::CaseInsensitive)) {
5023 auto *v =
new DomStringList();
5025 setElementStringList(v);
5028 if (!tag.compare(u"number"_s, Qt::CaseInsensitive)) {
5029 setElementNumber(reader.readElementText().toInt());
5032 if (!tag.compare(u"float"_s, Qt::CaseInsensitive)) {
5033 setElementFloat(reader.readElementText().toFloat());
5036 if (!tag.compare(u"double"_s, Qt::CaseInsensitive)) {
5037 setElementDouble(reader.readElementText().toDouble());
5040 if (!tag.compare(u"date"_s, Qt::CaseInsensitive)) {
5041 auto *v =
new DomDate();
5046 if (!tag.compare(u"time"_s, Qt::CaseInsensitive)) {
5047 auto *v =
new DomTime();
5052 if (!tag.compare(u"datetime"_s, Qt::CaseInsensitive)) {
5053 auto *v =
new DomDateTime();
5055 setElementDateTime(v);
5058 if (!tag.compare(u"pointf"_s, Qt::CaseInsensitive)) {
5059 auto *v =
new DomPointF();
5061 setElementPointF(v);
5064 if (!tag.compare(u"rectf"_s, Qt::CaseInsensitive)) {
5065 auto *v =
new DomRectF();
5070 if (!tag.compare(u"sizef"_s, Qt::CaseInsensitive)) {
5071 auto *v =
new DomSizeF();
5076 if (!tag.compare(u"longlong"_s, Qt::CaseInsensitive)) {
5077 setElementLongLong(reader.readElementText().toLongLong());
5080 if (!tag.compare(u"char"_s, Qt::CaseInsensitive)) {
5081 auto *v =
new DomChar();
5086 if (!tag.compare(u"url"_s, Qt::CaseInsensitive)) {
5087 auto *v =
new DomUrl();
5092 if (!tag.compare(u"uint"_s, Qt::CaseInsensitive)) {
5093 setElementUInt(reader.readElementText().toUInt());
5096 if (!tag.compare(u"ulonglong"_s, Qt::CaseInsensitive)) {
5097 setElementULongLong(reader.readElementText().toULongLong());
5100 if (!tag.compare(u"brush"_s, Qt::CaseInsensitive)) {
5101 auto *v =
new DomBrush();
5106 reader.raiseError(
"Unexpected element "_L1 + tag);
5109 case QXmlStreamReader::EndElement :
5117void DomProperty::write(QXmlStreamWriter &writer,
const QString &tagName)
const
5119 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral(
"property") : tagName.toLower());
5121 if (hasAttributeName())
5122 writer.writeAttribute(u"name"_s, attributeName());
5124 if (hasAttributeStdset())
5125 writer.writeAttribute(u"stdset"_s, QString::number(attributeStdset()));
5129 writer.writeTextElement(u"bool"_s, elementBool());
5133 if (m_color !=
nullptr)
5134 m_color->write(writer, u"color"_s);
5138 writer.writeTextElement(u"cstring"_s, elementCstring());
5142 writer.writeTextElement(u"cursor"_s, QString::number(elementCursor()));
5146 writer.writeTextElement(u"cursorShape"_s, elementCursorShape());
5150 writer.writeTextElement(u"enum"_s, elementEnum());
5154 if (m_font !=
nullptr)
5155 m_font->write(writer, u"font"_s);
5159 if (m_iconSet !=
nullptr)
5160 m_iconSet->write(writer, u"iconset"_s);
5164 if (m_pixmap !=
nullptr)
5165 m_pixmap->write(writer, u"pixmap"_s);
5169 if (m_palette !=
nullptr)
5170 m_palette->write(writer, u"palette"_s);
5174 if (m_point !=
nullptr)
5175 m_point->write(writer, u"point"_s);
5179 if (m_rect !=
nullptr)
5180 m_rect->write(writer, u"rect"_s);
5184 writer.writeTextElement(u"set"_s, elementSet());
5188 if (m_locale !=
nullptr)
5189 m_locale->write(writer, u"locale"_s);
5193 if (m_sizePolicy !=
nullptr)
5194 m_sizePolicy->write(writer, u"sizepolicy"_s);
5198 if (m_size !=
nullptr)
5199 m_size->write(writer, u"size"_s);
5203 if (m_string !=
nullptr)
5204 m_string->write(writer, u"string"_s);
5208 if (m_stringList !=
nullptr)
5209 m_stringList->write(writer, u"stringlist"_s);
5213 writer.writeTextElement(u"number"_s, QString::number(elementNumber()));
5217 writer.writeTextElement(u"float"_s, QString::number(elementFloat(),
'f', 8));
5221 writer.writeTextElement(u"double"_s, QString::number(elementDouble(),
'f', 15));
5225 if (m_date !=
nullptr)
5226 m_date->write(writer, u"date"_s);
5230 if (m_time !=
nullptr)
5231 m_time->write(writer, u"time"_s);
5235 if (m_dateTime !=
nullptr)
5236 m_dateTime->write(writer, u"datetime"_s);
5240 if (m_pointF !=
nullptr)
5241 m_pointF->write(writer, u"pointf"_s);
5245 if (m_rectF !=
nullptr)
5246 m_rectF->write(writer, u"rectf"_s);
5250 if (m_sizeF !=
nullptr)
5251 m_sizeF->write(writer, u"sizef"_s);
5255 writer.writeTextElement(u"longLong"_s, QString::number(elementLongLong()));
5259 if (m_char !=
nullptr)
5260 m_char->write(writer, u"char"_s);
5264 if (m_url !=
nullptr)
5265 m_url->write(writer, u"url"_s);
5269 writer.writeTextElement(u"UInt"_s, QString::number(elementUInt()));
5273 writer.writeTextElement(u"uLongLong"_s, QString::number(elementULongLong()));
5277 if (m_brush !=
nullptr)
5278 m_brush->write(writer, u"brush"_s);
5284 writer.writeEndElement();
5287void DomProperty::setElementBool(
const QString &a)
5294DomColor *DomProperty::takeElementColor()
5296 DomColor *a = m_color;
5301void DomProperty::setElementColor(DomColor *a)
5308void DomProperty::setElementCstring(
const QString &a)
5315void DomProperty::setElementCursor(
int a)
5322void DomProperty::setElementCursorShape(
const QString &a)
5325 m_kind = CursorShape;
5329void DomProperty::setElementEnum(
const QString &a)
5336DomFont *DomProperty::takeElementFont()
5338 DomFont *a = m_font;
5343void DomProperty::setElementFont(DomFont *a)
5350DomResourceIcon *DomProperty::takeElementIconSet()
5352 DomResourceIcon *a = m_iconSet;
5353 m_iconSet =
nullptr;
5357void DomProperty::setElementIconSet(DomResourceIcon *a)
5364DomResourcePixmap *DomProperty::takeElementPixmap()
5366 DomResourcePixmap *a = m_pixmap;
5371void DomProperty::setElementPixmap(DomResourcePixmap *a)
5378DomPalette *DomProperty::takeElementPalette()
5380 DomPalette *a = m_palette;
5381 m_palette =
nullptr;
5385void DomProperty::setElementPalette(DomPalette *a)
5392DomPoint *DomProperty::takeElementPoint()
5394 DomPoint *a = m_point;
5399void DomProperty::setElementPoint(DomPoint *a)
5406DomRect *DomProperty::takeElementRect()
5408 DomRect *a = m_rect;
5413void DomProperty::setElementRect(DomRect *a)
5420void DomProperty::setElementSet(
const QString &a)
5427DomLocale *DomProperty::takeElementLocale()
5429 DomLocale *a = m_locale;
5434void DomProperty::setElementLocale(DomLocale *a)
5441DomSizePolicy *DomProperty::takeElementSizePolicy()
5443 DomSizePolicy *a = m_sizePolicy;
5444 m_sizePolicy =
nullptr;
5448void DomProperty::setElementSizePolicy(DomSizePolicy *a)
5451 m_kind = SizePolicy;
5455DomSize *DomProperty::takeElementSize()
5457 DomSize *a = m_size;
5462void DomProperty::setElementSize(DomSize *a)
5469DomString *DomProperty::takeElementString()
5471 DomString *a = m_string;
5476void DomProperty::setElementString(DomString *a)
5483DomStringList *DomProperty::takeElementStringList()
5485 DomStringList *a = m_stringList;
5486 m_stringList =
nullptr;
5490void DomProperty::setElementStringList(DomStringList *a)
5493 m_kind = StringList;
5497void DomProperty::setElementNumber(
int a)
5504void DomProperty::setElementFloat(
float a)
5511void DomProperty::setElementDouble(
double a)
5518DomDate *DomProperty::takeElementDate()
5520 DomDate *a = m_date;
5525void DomProperty::setElementDate(DomDate *a)
5532DomTime *DomProperty::takeElementTime()
5534 DomTime *a = m_time;
5539void DomProperty::setElementTime(DomTime *a)
5546DomDateTime *DomProperty::takeElementDateTime()
5548 DomDateTime *a = m_dateTime;
5549 m_dateTime =
nullptr;
5553void DomProperty::setElementDateTime(DomDateTime *a)
5560DomPointF *DomProperty::takeElementPointF()
5562 DomPointF *a = m_pointF;
5567void DomProperty::setElementPointF(DomPointF *a)
5574DomRectF *DomProperty::takeElementRectF()
5576 DomRectF *a = m_rectF;
5581void DomProperty::setElementRectF(DomRectF *a)
5588DomSizeF *DomProperty::takeElementSizeF()
5590 DomSizeF *a = m_sizeF;
5595void DomProperty::setElementSizeF(DomSizeF *a)
5602void DomProperty::setElementLongLong(qlonglong a)
5609DomChar *DomProperty::takeElementChar()
5611 DomChar *a = m_char;
5616void DomProperty::setElementChar(DomChar *a)
5623DomUrl *DomProperty::takeElementUrl()
5630void DomProperty::setElementUrl(DomUrl *a)
5637void DomProperty::setElementUInt(uint a)
5644void DomProperty::setElementULongLong(qulonglong a)
5651DomBrush *DomProperty::takeElementBrush()
5653 DomBrush *a = m_brush;
5658void DomProperty::setElementBrush(DomBrush *a)
5665DomConnections::~DomConnections()
5667 qDeleteAll(m_connection);
5668 m_connection.clear();
5671void DomConnections::read(QXmlStreamReader &reader)
5673 while (!reader.hasError()) {
5674 switch (reader.readNext()) {
5675 case QXmlStreamReader::StartElement : {
5676 const auto tag = reader.name();
5677 if (!tag.compare(u"connection"_s, Qt::CaseInsensitive)) {
5678 auto *v =
new DomConnection();
5680 m_connection.append(v);
5683 reader.raiseError(
"Unexpected element "_L1 + tag);
5686 case QXmlStreamReader::EndElement :
5694void DomConnections::write(QXmlStreamWriter &writer,
const QString &tagName)
const
5696 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral(
"connections") : tagName.toLower());
5698 for (DomConnection *v : m_connection)
5699 v->write(writer, u"connection"_s);
5701 writer.writeEndElement();
5704void DomConnections::setElementConnection(
const QList<DomConnection *> &a)
5706 m_children |= Connection;
5710DomConnection::~DomConnection()
5715void DomConnection::read(QXmlStreamReader &reader)
5717 while (!reader.hasError()) {
5718 switch (reader.readNext()) {
5719 case QXmlStreamReader::StartElement : {
5720 const auto tag = reader.name();
5721 if (!tag.compare(u"sender"_s, Qt::CaseInsensitive)) {
5722 setElementSender(reader.readElementText());
5725 if (!tag.compare(u"signal"_s, Qt::CaseInsensitive)) {
5726 setElementSignal(reader.readElementText());
5729 if (!tag.compare(u"receiver"_s, Qt::CaseInsensitive)) {
5730 setElementReceiver(reader.readElementText());
5733 if (!tag.compare(u"slot"_s, Qt::CaseInsensitive)) {
5734 setElementSlot(reader.readElementText());
5737 if (!tag.compare(u"hints"_s, Qt::CaseInsensitive)) {
5738 auto *v =
new DomConnectionHints();
5743 reader.raiseError(
"Unexpected element "_L1 + tag);
5746 case QXmlStreamReader::EndElement :
5754void DomConnection::write(QXmlStreamWriter &writer,
const QString &tagName)
const
5756 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral(
"connection") : tagName.toLower());
5758 if (m_children & Sender)
5759 writer.writeTextElement(u"sender"_s, m_sender);
5761 if (m_children & Signal)
5762 writer.writeTextElement(u"signal"_s, m_signal);
5764 if (m_children & Receiver)
5765 writer.writeTextElement(u"receiver"_s, m_receiver);
5767 if (m_children & Slot)
5768 writer.writeTextElement(u"slot"_s, m_slot);
5770 if (m_children & Hints)
5771 m_hints->write(writer, u"hints"_s);
5773 writer.writeEndElement();
5776void DomConnection::setElementSender(
const QString &a)
5778 m_children |= Sender;
5782void DomConnection::setElementSignal(
const QString &a)
5784 m_children |= Signal;
5788void DomConnection::setElementReceiver(
const QString &a)
5790 m_children |= Receiver;
5794void DomConnection::setElementSlot(
const QString &a)
5800DomConnectionHints *DomConnection::takeElementHints()
5802 DomConnectionHints *a = m_hints;
5804 m_children ^= Hints;
5808void DomConnection::setElementHints(DomConnectionHints *a)
5811 m_children |= Hints;
5815void DomConnection::clearElementSender()
5817 m_children &= ~Sender;
5820void DomConnection::clearElementSignal()
5822 m_children &= ~Signal;
5825void DomConnection::clearElementReceiver()
5827 m_children &= ~Receiver;
5830void DomConnection::clearElementSlot()
5832 m_children &= ~Slot;
5835void DomConnection::clearElementHints()
5839 m_children &= ~Hints;
5842DomConnectionHints::~DomConnectionHints()
5848void DomConnectionHints::read(QXmlStreamReader &reader)
5850 while (!reader.hasError()) {
5851 switch (reader.readNext()) {
5852 case QXmlStreamReader::StartElement : {
5853 const auto tag = reader.name();
5854 if (!tag.compare(u"hint"_s, Qt::CaseInsensitive)) {
5855 auto *v =
new DomConnectionHint();
5860 reader.raiseError(
"Unexpected element "_L1 + tag);
5863 case QXmlStreamReader::EndElement :
5871void DomConnectionHints::write(QXmlStreamWriter &writer,
const QString &tagName)
const
5873 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral(
"connectionhints") : tagName.toLower());
5875 for (DomConnectionHint *v : m_hint)
5876 v->write(writer, u"hint"_s);
5878 writer.writeEndElement();
5881void DomConnectionHints::setElementHint(
const QList<DomConnectionHint *> &a)
5887DomConnectionHint::~DomConnectionHint() =
default;
5889void DomConnectionHint::read(QXmlStreamReader &reader)
5891 const QXmlStreamAttributes &attributes = reader.attributes();
5892 for (
const QXmlStreamAttribute &attribute : attributes) {
5893 const auto name = attribute.name();
5894 if (name == u"type"_s) {
5895 setAttributeType(attribute.value().toString());
5898 reader.raiseError(
"Unexpected attribute "_L1 + name);
5901 while (!reader.hasError()) {
5902 switch (reader.readNext()) {
5903 case QXmlStreamReader::StartElement : {
5904 const auto tag = reader.name();
5905 if (!tag.compare(u"x"_s, Qt::CaseInsensitive)) {
5906 setElementX(reader.readElementText().toInt());
5909 if (!tag.compare(u"y"_s, Qt::CaseInsensitive)) {
5910 setElementY(reader.readElementText().toInt());
5913 reader.raiseError(
"Unexpected element "_L1 + tag);
5916 case QXmlStreamReader::EndElement :
5924void DomConnectionHint::write(QXmlStreamWriter &writer,
const QString &tagName)
const
5926 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral(
"connectionhint") : tagName.toLower());
5928 if (hasAttributeType())
5929 writer.writeAttribute(u"type"_s, attributeType());
5932 writer.writeTextElement(u"x"_s, QString::number(m_x));
5935 writer.writeTextElement(u"y"_s, QString::number(m_y));
5937 writer.writeEndElement();
5940void DomConnectionHint::setElementX(
int a)
5946void DomConnectionHint::setElementY(
int a)
5952void DomConnectionHint::clearElementX()
5957void DomConnectionHint::clearElementY()
5962DomDesignerData::~DomDesignerData()
5964 qDeleteAll(m_property);
5968void DomDesignerData::read(QXmlStreamReader &reader)
5970 while (!reader.hasError()) {
5971 switch (reader.readNext()) {
5972 case QXmlStreamReader::StartElement : {
5973 const auto tag = reader.name();
5974 if (!tag.compare(u"property"_s, Qt::CaseInsensitive)) {
5975 auto *v =
new DomProperty();
5977 m_property.append(v);
5980 reader.raiseError(
"Unexpected element "_L1 + tag);
5983 case QXmlStreamReader::EndElement :
5991void DomDesignerData::write(QXmlStreamWriter &writer,
const QString &tagName)
const
5993 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral(
"designerdata") : tagName.toLower());
5995 for (DomProperty *v : m_property)
5996 v->write(writer, u"property"_s);
5998 writer.writeEndElement();
6001void DomDesignerData::setElementProperty(
const QList<DomProperty *> &a)
6003 m_children |= Property;
6007DomSlots::~DomSlots()
6013void DomSlots::read(QXmlStreamReader &reader)
6015 while (!reader.hasError()) {
6016 switch (reader.readNext()) {
6017 case QXmlStreamReader::StartElement : {
6018 const auto tag = reader.name();
6019 if (!tag.compare(u"signal"_s, Qt::CaseInsensitive)) {
6020 m_signal.append(reader.readElementText());
6023 if (!tag.compare(u"slot"_s, Qt::CaseInsensitive)) {
6024 m_slot.append(reader.readElementText());
6027 reader.raiseError(
"Unexpected element "_L1 + tag);
6030 case QXmlStreamReader::EndElement :
6038void DomSlots::write(QXmlStreamWriter &writer,
const QString &tagName)
const
6040 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral(
"slots") : tagName.toLower());
6042 for (
const QString &v : m_signal)
6043 writer.writeTextElement(u"signal"_s, v);
6045 for (
const QString &v : m_slot)
6046 writer.writeTextElement(u"slot"_s, v);
6048 writer.writeEndElement();
6051void DomSlots::setElementSignal(
const QStringList &a)
6053 m_children |= Signal;
6057void DomSlots::setElementSlot(
const QStringList &a)
6063DomPropertySpecifications::~DomPropertySpecifications()
6065 qDeleteAll(m_tooltip);
6067 qDeleteAll(m_stringpropertyspecification);
6068 m_stringpropertyspecification.clear();
6071void DomPropertySpecifications::read(QXmlStreamReader &reader)
6073 while (!reader.hasError()) {
6074 switch (reader.readNext()) {
6075 case QXmlStreamReader::StartElement : {
6076 const auto tag = reader.name();
6077 if (!tag.compare(u"tooltip"_s, Qt::CaseInsensitive)) {
6078 auto *v =
new DomPropertyToolTip();
6080 m_tooltip.append(v);
6083 if (!tag.compare(u"stringpropertyspecification"_s, Qt::CaseInsensitive)) {
6084 auto *v =
new DomStringPropertySpecification();
6086 m_stringpropertyspecification.append(v);
6089 reader.raiseError(
"Unexpected element "_L1 + tag);
6092 case QXmlStreamReader::EndElement :
6100void DomPropertySpecifications::write(QXmlStreamWriter &writer,
const QString &tagName)
const
6102 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral(
"propertyspecifications") : tagName.toLower());
6104 for (DomPropertyToolTip *v : m_tooltip)
6105 v->write(writer, u"tooltip"_s);
6107 for (DomStringPropertySpecification *v : m_stringpropertyspecification)
6108 v->write(writer, u"stringpropertyspecification"_s);
6110 writer.writeEndElement();
6113void DomPropertySpecifications::setElementTooltip(
const QList<DomPropertyToolTip *> &a)
6115 m_children |= Tooltip;
6119void DomPropertySpecifications::setElementStringpropertyspecification(
const QList<DomStringPropertySpecification *> &a)
6121 m_children |= Stringpropertyspecification;
6122 m_stringpropertyspecification = a;
6125DomPropertyToolTip::~DomPropertyToolTip() =
default;
6127void DomPropertyToolTip::read(QXmlStreamReader &reader)
6129 const QXmlStreamAttributes &attributes = reader.attributes();
6130 for (
const QXmlStreamAttribute &attribute : attributes) {
6131 const auto name = attribute.name();
6132 if (name == u"name"_s) {
6133 setAttributeName(attribute.value().toString());
6136 reader.raiseError(
"Unexpected attribute "_L1 + name);
6139 while (!reader.hasError()) {
6140 switch (reader.readNext()) {
6141 case QXmlStreamReader::StartElement : {
6142 const auto tag = reader.name();
6143 reader.raiseError(
"Unexpected element "_L1 + tag);
6146 case QXmlStreamReader::EndElement :
6154void DomPropertyToolTip::write(QXmlStreamWriter &writer,
const QString &tagName)
const
6156 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral(
"propertytooltip") : tagName.toLower());
6158 if (hasAttributeName())
6159 writer.writeAttribute(u"name"_s, attributeName());
6161 writer.writeEndElement();
6164DomStringPropertySpecification::~DomStringPropertySpecification() =
default;
6166void DomStringPropertySpecification::read(QXmlStreamReader &reader)
6168 const QXmlStreamAttributes &attributes = reader.attributes();
6169 for (
const QXmlStreamAttribute &attribute : attributes) {
6170 const auto name = attribute.name();
6171 if (name == u"name"_s) {
6172 setAttributeName(attribute.value().toString());
6175 if (name == u"type"_s) {
6176 setAttributeType(attribute.value().toString());
6179 if (name == u"notr"_s) {
6180 setAttributeNotr(attribute.value().toString());
6183 reader.raiseError(
"Unexpected attribute "_L1 + name);
6186 while (!reader.hasError()) {
6187 switch (reader.readNext()) {
6188 case QXmlStreamReader::StartElement : {
6189 const auto tag = reader.name();
6190 reader.raiseError(
"Unexpected element "_L1 + tag);
6193 case QXmlStreamReader::EndElement :
6201void DomStringPropertySpecification::write(QXmlStreamWriter &writer,
const QString &tagName)
const
6203 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral(
"stringpropertyspecification") : tagName.toLower());
6205 if (hasAttributeName())
6206 writer.writeAttribute(u"name"_s, attributeName());
6208 if (hasAttributeType())
6209 writer.writeAttribute(u"type"_s, attributeType());
6211 if (hasAttributeNotr())
6212 writer.writeAttribute(u"notr"_s, attributeNotr());
6214 writer.writeEndElement();
Combined button and popup list for selecting options.