13using namespace Qt::StringLiterals;
15#ifdef QFORMINTERNAL_NAMESPACE
16using namespace QFormInternal;
20
21
26 delete m_layoutDefault;
27 delete m_layoutFunction;
28 delete m_customWidgets;
33 delete m_designerdata;
35 delete m_buttonGroups;
38void DomUI::read(QXmlStreamReader &reader)
40 const QXmlStreamAttributes &attributes = reader.attributes();
41 for (
const QXmlStreamAttribute &attribute : attributes) {
42 const auto name = attribute.name();
43 if (name == u"version"_s) {
44 setAttributeVersion(attribute.value().toString());
47 if (name == u"language"_s) {
48 setAttributeLanguage(attribute.value().toString());
51 if (name == u"displayname"_s) {
52 setAttributeDisplayname(attribute.value().toString());
55 if (name == u"idbasedtr"_s) {
56 setAttributeIdbasedtr(attribute.value() == u"true"_s);
59 if (name == u"label"_s) {
60 setAttributeLabel(attribute.value().toString());
63 if (name == u"connectslotsbyname"_s) {
64 setAttributeConnectslotsbyname(attribute.value() == u"true"_s);
67 if (name == u"stdsetdef"_s) {
68 setAttributeStdsetdef(attribute.value().toInt());
71 if (name == u"stdSetDef"_s) {
72 setAttributeStdSetDef(attribute.value().toInt());
75 reader.raiseError(
"Unexpected attribute "_L1 + name);
78 while (!reader.hasError()) {
79 switch (reader.readNext()) {
80 case QXmlStreamReader::StartElement : {
81 const auto tag = reader.name();
82 if (!tag.compare(u"author"_s, Qt::CaseInsensitive)) {
83 setElementAuthor(reader.readElementText());
86 if (!tag.compare(u"comment"_s, Qt::CaseInsensitive)) {
87 setElementComment(reader.readElementText());
90 if (!tag.compare(u"exportmacro"_s, Qt::CaseInsensitive)) {
91 setElementExportMacro(reader.readElementText());
94 if (!tag.compare(u"class"_s, Qt::CaseInsensitive)) {
95 setElementClass(reader.readElementText());
98 if (!tag.compare(u"widget"_s, Qt::CaseInsensitive)) {
99 auto *v =
new DomWidget();
104 if (!tag.compare(u"layoutdefault"_s, Qt::CaseInsensitive)) {
105 auto *v =
new DomLayoutDefault();
107 setElementLayoutDefault(v);
110 if (!tag.compare(u"layoutfunction"_s, Qt::CaseInsensitive)) {
111 auto *v =
new DomLayoutFunction();
113 setElementLayoutFunction(v);
116 if (!tag.compare(u"pixmapfunction"_s, Qt::CaseInsensitive)) {
117 setElementPixmapFunction(reader.readElementText());
120 if (!tag.compare(u"customwidgets"_s, Qt::CaseInsensitive)) {
121 auto *v =
new DomCustomWidgets();
123 setElementCustomWidgets(v);
126 if (!tag.compare(u"tabstops"_s, Qt::CaseInsensitive)) {
127 auto *v =
new DomTabStops();
129 setElementTabStops(v);
132 if (!tag.compare(u"images"_s, Qt::CaseInsensitive)) {
133 qWarning(
"Omitting deprecated element <images>.");
134 reader.skipCurrentElement();
137 if (!tag.compare(u"includes"_s, Qt::CaseInsensitive)) {
138 auto *v =
new DomIncludes();
140 setElementIncludes(v);
143 if (!tag.compare(u"resources"_s, Qt::CaseInsensitive)) {
144 auto *v =
new DomResources();
146 setElementResources(v);
149 if (!tag.compare(u"connections"_s, Qt::CaseInsensitive)) {
150 auto *v =
new DomConnections();
152 setElementConnections(v);
155 if (!tag.compare(u"designerdata"_s, Qt::CaseInsensitive)) {
156 auto *v =
new DomDesignerData();
158 setElementDesignerdata(v);
161 if (!tag.compare(u"slots"_s, Qt::CaseInsensitive)) {
162 auto *v =
new DomSlots();
167 if (!tag.compare(u"buttongroups"_s, Qt::CaseInsensitive)) {
168 auto *v =
new DomButtonGroups();
170 setElementButtonGroups(v);
173 reader.raiseError(
"Unexpected element "_L1 + tag);
176 case QXmlStreamReader::EndElement :
184void DomUI::write(QXmlStreamWriter &writer,
const QString &tagName)
const
186 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"ui") : tagName.toLower());
188 if (hasAttributeVersion())
189 writer.writeAttribute(u"version"_s, attributeVersion());
191 if (hasAttributeLanguage())
192 writer.writeAttribute(u"language"_s, attributeLanguage());
194 if (hasAttributeDisplayname())
195 writer.writeAttribute(u"displayname"_s, attributeDisplayname());
197 if (hasAttributeIdbasedtr())
198 writer.writeAttribute(u"idbasedtr"_s, (attributeIdbasedtr() ? u"true"_s : u"false"_s));
200 if (hasAttributeLabel())
201 writer.writeAttribute(u"label"_s, attributeLabel());
203 if (hasAttributeConnectslotsbyname())
204 writer.writeAttribute(u"connectslotsbyname"_s, (attributeConnectslotsbyname() ? u"true"_s : u"false"_s));
206 if (hasAttributeStdsetdef())
207 writer.writeAttribute(u"stdsetdef"_s, QString::number(attributeStdsetdef()));
209 if (hasAttributeStdSetDef())
210 writer.writeAttribute(u"stdsetdef"_s, QString::number(attributeStdSetDef()));
212 if (m_children & Author)
213 writer.writeTextElement(u"author"_s, m_author);
215 if (m_children & Comment)
216 writer.writeTextElement(u"comment"_s, m_comment);
218 if (m_children & ExportMacro)
219 writer.writeTextElement(u"exportmacro"_s, m_exportMacro);
221 if (m_children & Class)
222 writer.writeTextElement(u"class"_s, m_class);
224 if (m_children & Widget)
225 m_widget->write(writer, u"widget"_s);
227 if (m_children & LayoutDefault)
228 m_layoutDefault->write(writer, u"layoutdefault"_s);
230 if (m_children & LayoutFunction)
231 m_layoutFunction->write(writer, u"layoutfunction"_s);
233 if (m_children & PixmapFunction)
234 writer.writeTextElement(u"pixmapfunction"_s, m_pixmapFunction);
236 if (m_children & CustomWidgets)
237 m_customWidgets->write(writer, u"customwidgets"_s);
239 if (m_children & TabStops)
240 m_tabStops->write(writer, u"tabstops"_s);
242 if (m_children & Includes)
243 m_includes->write(writer, u"includes"_s);
245 if (m_children & Resources)
246 m_resources->write(writer, u"resources"_s);
248 if (m_children & Connections)
249 m_connections->write(writer, u"connections"_s);
251 if (m_children & Designerdata)
252 m_designerdata->write(writer, u"designerdata"_s);
254 if (m_children & Slots)
255 m_slots->write(writer, u"slots"_s);
257 if (m_children & ButtonGroups)
258 m_buttonGroups->write(writer, u"buttongroups"_s);
260 writer.writeEndElement();
263void DomUI::setElementAuthor(
const QString &a)
265 m_children |= Author;
269void DomUI::setElementComment(
const QString &a)
271 m_children |= Comment;
275void DomUI::setElementExportMacro(
const QString &a)
277 m_children |= ExportMacro;
281void DomUI::setElementClass(
const QString &a)
287DomWidget *DomUI::takeElementWidget()
289 DomWidget *a = m_widget;
291 m_children ^= Widget;
295void DomUI::setElementWidget(DomWidget *a)
298 m_children |= Widget;
302DomLayoutDefault *DomUI::takeElementLayoutDefault()
304 DomLayoutDefault *a = m_layoutDefault;
305 m_layoutDefault =
nullptr;
306 m_children ^= LayoutDefault;
310void DomUI::setElementLayoutDefault(DomLayoutDefault *a)
312 delete m_layoutDefault;
313 m_children |= LayoutDefault;
317DomLayoutFunction *DomUI::takeElementLayoutFunction()
319 DomLayoutFunction *a = m_layoutFunction;
320 m_layoutFunction =
nullptr;
321 m_children ^= LayoutFunction;
325void DomUI::setElementLayoutFunction(DomLayoutFunction *a)
327 delete m_layoutFunction;
328 m_children |= LayoutFunction;
329 m_layoutFunction = a;
332void DomUI::setElementPixmapFunction(
const QString &a)
334 m_children |= PixmapFunction;
335 m_pixmapFunction = a;
338DomCustomWidgets *DomUI::takeElementCustomWidgets()
340 DomCustomWidgets *a = m_customWidgets;
341 m_customWidgets =
nullptr;
342 m_children ^= CustomWidgets;
346void DomUI::setElementCustomWidgets(DomCustomWidgets *a)
348 delete m_customWidgets;
349 m_children |= CustomWidgets;
353DomTabStops *DomUI::takeElementTabStops()
355 DomTabStops *a = m_tabStops;
356 m_tabStops =
nullptr;
357 m_children ^= TabStops;
361void DomUI::setElementTabStops(DomTabStops *a)
364 m_children |= TabStops;
368DomIncludes *DomUI::takeElementIncludes()
370 DomIncludes *a = m_includes;
371 m_includes =
nullptr;
372 m_children ^= Includes;
376void DomUI::setElementIncludes(DomIncludes *a)
379 m_children |= Includes;
383DomResources *DomUI::takeElementResources()
385 DomResources *a = m_resources;
386 m_resources =
nullptr;
387 m_children ^= Resources;
391void DomUI::setElementResources(DomResources *a)
394 m_children |= Resources;
398DomConnections *DomUI::takeElementConnections()
400 DomConnections *a = m_connections;
401 m_connections =
nullptr;
402 m_children ^= Connections;
406void DomUI::setElementConnections(DomConnections *a)
408 delete m_connections;
409 m_children |= Connections;
413DomDesignerData *DomUI::takeElementDesignerdata()
415 DomDesignerData *a = m_designerdata;
416 m_designerdata =
nullptr;
417 m_children ^= Designerdata;
421void DomUI::setElementDesignerdata(DomDesignerData *a)
423 delete m_designerdata;
424 m_children |= Designerdata;
428DomSlots *DomUI::takeElementSlots()
430 DomSlots *a = m_slots;
436void DomUI::setElementSlots(DomSlots *a)
443DomButtonGroups *DomUI::takeElementButtonGroups()
445 DomButtonGroups *a = m_buttonGroups;
446 m_buttonGroups =
nullptr;
447 m_children ^= ButtonGroups;
451void DomUI::setElementButtonGroups(DomButtonGroups *a)
453 delete m_buttonGroups;
454 m_children |= ButtonGroups;
458void DomUI::clearElementAuthor()
460 m_children &= ~Author;
463void DomUI::clearElementComment()
465 m_children &= ~Comment;
468void DomUI::clearElementExportMacro()
470 m_children &= ~ExportMacro;
473void DomUI::clearElementClass()
475 m_children &= ~Class;
478void DomUI::clearElementWidget()
482 m_children &= ~Widget;
485void DomUI::clearElementLayoutDefault()
487 delete m_layoutDefault;
488 m_layoutDefault =
nullptr;
489 m_children &= ~LayoutDefault;
492void DomUI::clearElementLayoutFunction()
494 delete m_layoutFunction;
495 m_layoutFunction =
nullptr;
496 m_children &= ~LayoutFunction;
499void DomUI::clearElementPixmapFunction()
501 m_children &= ~PixmapFunction;
504void DomUI::clearElementCustomWidgets()
506 delete m_customWidgets;
507 m_customWidgets =
nullptr;
508 m_children &= ~CustomWidgets;
511void DomUI::clearElementTabStops()
514 m_tabStops =
nullptr;
515 m_children &= ~TabStops;
518void DomUI::clearElementIncludes()
521 m_includes =
nullptr;
522 m_children &= ~Includes;
525void DomUI::clearElementResources()
528 m_resources =
nullptr;
529 m_children &= ~Resources;
532void DomUI::clearElementConnections()
534 delete m_connections;
535 m_connections =
nullptr;
536 m_children &= ~Connections;
539void DomUI::clearElementDesignerdata()
541 delete m_designerdata;
542 m_designerdata =
nullptr;
543 m_children &= ~Designerdata;
546void DomUI::clearElementSlots()
550 m_children &= ~Slots;
553void DomUI::clearElementButtonGroups()
555 delete m_buttonGroups;
556 m_buttonGroups =
nullptr;
557 m_children &= ~ButtonGroups;
560DomIncludes::~DomIncludes()
562 qDeleteAll(m_include);
566void DomIncludes::read(QXmlStreamReader &reader)
568 while (!reader.hasError()) {
569 switch (reader.readNext()) {
570 case QXmlStreamReader::StartElement : {
571 const auto tag = reader.name();
572 if (!tag.compare(u"include"_s, Qt::CaseInsensitive)) {
573 auto *v =
new DomInclude();
578 reader.raiseError(
"Unexpected element "_L1 + tag);
581 case QXmlStreamReader::EndElement :
589void DomIncludes::write(QXmlStreamWriter &writer,
const QString &tagName)
const
591 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"includes") : tagName.toLower());
593 for (DomInclude *v : m_include)
594 v->write(writer, u"include"_s);
596 writer.writeEndElement();
599void DomIncludes::setElementInclude(
const QList<DomInclude *> &a)
601 m_children |= Include;
605DomInclude::~DomInclude() =
default;
607void DomInclude::read(QXmlStreamReader &reader)
609 const QXmlStreamAttributes &attributes = reader.attributes();
610 for (
const QXmlStreamAttribute &attribute : attributes) {
611 const auto name = attribute.name();
612 if (name == u"location"_s) {
613 setAttributeLocation(attribute.value().toString());
616 if (name == u"impldecl"_s) {
617 setAttributeImpldecl(attribute.value().toString());
620 reader.raiseError(
"Unexpected attribute "_L1 + name);
623 while (!reader.hasError()) {
624 switch (reader.readNext()) {
625 case QXmlStreamReader::StartElement : {
626 const auto tag = reader.name();
627 reader.raiseError(
"Unexpected element "_L1 + tag);
630 case QXmlStreamReader::EndElement :
632 case QXmlStreamReader::Characters :
633 if (!reader.isWhitespace())
634 m_text.append(reader.text().toString());
642void DomInclude::write(QXmlStreamWriter &writer,
const QString &tagName)
const
644 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"include") : tagName.toLower());
646 if (hasAttributeLocation())
647 writer.writeAttribute(u"location"_s, attributeLocation());
649 if (hasAttributeImpldecl())
650 writer.writeAttribute(u"impldecl"_s, attributeImpldecl());
652 if (!m_text.isEmpty())
653 writer.writeCharacters(m_text);
655 writer.writeEndElement();
658DomResources::~DomResources()
660 qDeleteAll(m_include);
664void DomResources::read(QXmlStreamReader &reader)
666 const QXmlStreamAttributes &attributes = reader.attributes();
667 for (
const QXmlStreamAttribute &attribute : attributes) {
668 const auto name = attribute.name();
669 if (name == u"name"_s) {
670 setAttributeName(attribute.value().toString());
673 reader.raiseError(
"Unexpected attribute "_L1 + name);
676 while (!reader.hasError()) {
677 switch (reader.readNext()) {
678 case QXmlStreamReader::StartElement : {
679 const auto tag = reader.name();
680 if (!tag.compare(u"include"_s, Qt::CaseInsensitive)) {
681 auto *v =
new DomResource();
686 reader.raiseError(
"Unexpected element "_L1 + tag);
689 case QXmlStreamReader::EndElement :
697void DomResources::write(QXmlStreamWriter &writer,
const QString &tagName)
const
699 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"resources") : tagName.toLower());
701 if (hasAttributeName())
702 writer.writeAttribute(u"name"_s, attributeName());
704 for (DomResource *v : m_include)
705 v->write(writer, u"include"_s);
707 writer.writeEndElement();
710void DomResources::setElementInclude(
const QList<DomResource *> &a)
712 m_children |= Include;
716DomResource::~DomResource() =
default;
718void DomResource::read(QXmlStreamReader &reader)
720 const QXmlStreamAttributes &attributes = reader.attributes();
721 for (
const QXmlStreamAttribute &attribute : attributes) {
722 const auto name = attribute.name();
723 if (name == u"location"_s) {
724 setAttributeLocation(attribute.value().toString());
727 reader.raiseError(
"Unexpected attribute "_L1 + name);
730 while (!reader.hasError()) {
731 switch (reader.readNext()) {
732 case QXmlStreamReader::StartElement : {
733 const auto tag = reader.name();
734 reader.raiseError(
"Unexpected element "_L1 + tag);
737 case QXmlStreamReader::EndElement :
745void DomResource::write(QXmlStreamWriter &writer,
const QString &tagName)
const
747 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"resource") : tagName.toLower());
749 if (hasAttributeLocation())
750 writer.writeAttribute(u"location"_s, attributeLocation());
752 writer.writeEndElement();
755DomActionGroup::~DomActionGroup()
757 qDeleteAll(m_action);
759 qDeleteAll(m_actionGroup);
760 m_actionGroup.clear();
761 qDeleteAll(m_property);
763 qDeleteAll(m_attribute);
767void DomActionGroup::read(QXmlStreamReader &reader)
769 const QXmlStreamAttributes &attributes = reader.attributes();
770 for (
const QXmlStreamAttribute &attribute : attributes) {
771 const auto name = attribute.name();
772 if (name == u"name"_s) {
773 setAttributeName(attribute.value().toString());
776 reader.raiseError(
"Unexpected attribute "_L1 + name);
779 while (!reader.hasError()) {
780 switch (reader.readNext()) {
781 case QXmlStreamReader::StartElement : {
782 const auto tag = reader.name();
783 if (!tag.compare(u"action"_s, Qt::CaseInsensitive)) {
784 auto *v =
new DomAction();
789 if (!tag.compare(u"actiongroup"_s, Qt::CaseInsensitive)) {
790 auto *v =
new DomActionGroup();
792 m_actionGroup.append(v);
795 if (!tag.compare(u"property"_s, Qt::CaseInsensitive)) {
796 auto *v =
new DomProperty();
798 m_property.append(v);
801 if (!tag.compare(u"attribute"_s, Qt::CaseInsensitive)) {
802 auto *v =
new DomProperty();
804 m_attribute.append(v);
807 reader.raiseError(
"Unexpected element "_L1 + tag);
810 case QXmlStreamReader::EndElement :
818void DomActionGroup::write(QXmlStreamWriter &writer,
const QString &tagName)
const
820 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"actiongroup") : tagName.toLower());
822 if (hasAttributeName())
823 writer.writeAttribute(u"name"_s, attributeName());
825 for (DomAction *v : m_action)
826 v->write(writer, u"action"_s);
828 for (DomActionGroup *v : m_actionGroup)
829 v->write(writer, u"actiongroup"_s);
831 for (DomProperty *v : m_property)
832 v->write(writer, u"property"_s);
834 for (DomProperty *v : m_attribute)
835 v->write(writer, u"attribute"_s);
837 writer.writeEndElement();
840void DomActionGroup::setElementAction(
const QList<DomAction *> &a)
842 m_children |= Action;
846void DomActionGroup::setElementActionGroup(
const QList<DomActionGroup *> &a)
848 m_children |= ActionGroup;
852void DomActionGroup::setElementProperty(
const QList<DomProperty *> &a)
854 m_children |= Property;
858void DomActionGroup::setElementAttribute(
const QList<DomProperty *> &a)
860 m_children |= Attribute;
864DomAction::~DomAction()
866 qDeleteAll(m_property);
868 qDeleteAll(m_attribute);
872void DomAction::read(QXmlStreamReader &reader)
874 const QXmlStreamAttributes &attributes = reader.attributes();
875 for (
const QXmlStreamAttribute &attribute : attributes) {
876 const auto name = attribute.name();
877 if (name == u"name"_s) {
878 setAttributeName(attribute.value().toString());
881 if (name == u"menu"_s) {
882 setAttributeMenu(attribute.value().toString());
885 reader.raiseError(
"Unexpected attribute "_L1 + name);
888 while (!reader.hasError()) {
889 switch (reader.readNext()) {
890 case QXmlStreamReader::StartElement : {
891 const auto tag = reader.name();
892 if (!tag.compare(u"property"_s, Qt::CaseInsensitive)) {
893 auto *v =
new DomProperty();
895 m_property.append(v);
898 if (!tag.compare(u"attribute"_s, Qt::CaseInsensitive)) {
899 auto *v =
new DomProperty();
901 m_attribute.append(v);
904 reader.raiseError(
"Unexpected element "_L1 + tag);
907 case QXmlStreamReader::EndElement :
915void DomAction::write(QXmlStreamWriter &writer,
const QString &tagName)
const
917 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"action") : tagName.toLower());
919 if (hasAttributeName())
920 writer.writeAttribute(u"name"_s, attributeName());
922 if (hasAttributeMenu())
923 writer.writeAttribute(u"menu"_s, attributeMenu());
925 for (DomProperty *v : m_property)
926 v->write(writer, u"property"_s);
928 for (DomProperty *v : m_attribute)
929 v->write(writer, u"attribute"_s);
931 writer.writeEndElement();
934void DomAction::setElementProperty(
const QList<DomProperty *> &a)
936 m_children |= Property;
940void DomAction::setElementAttribute(
const QList<DomProperty *> &a)
942 m_children |= Attribute;
946DomActionRef::~DomActionRef() =
default;
948void DomActionRef::read(QXmlStreamReader &reader)
950 const QXmlStreamAttributes &attributes = reader.attributes();
951 for (
const QXmlStreamAttribute &attribute : attributes) {
952 const auto name = attribute.name();
953 if (name == u"name"_s) {
954 setAttributeName(attribute.value().toString());
957 reader.raiseError(
"Unexpected attribute "_L1 + name);
960 while (!reader.hasError()) {
961 switch (reader.readNext()) {
962 case QXmlStreamReader::StartElement : {
963 const auto tag = reader.name();
964 reader.raiseError(
"Unexpected element "_L1 + tag);
967 case QXmlStreamReader::EndElement :
975void DomActionRef::write(QXmlStreamWriter &writer,
const QString &tagName)
const
977 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"actionref") : tagName.toLower());
979 if (hasAttributeName())
980 writer.writeAttribute(u"name"_s, attributeName());
982 writer.writeEndElement();
985DomButtonGroup::~DomButtonGroup()
987 qDeleteAll(m_property);
989 qDeleteAll(m_attribute);
993void DomButtonGroup::read(QXmlStreamReader &reader)
995 const QXmlStreamAttributes &attributes = reader.attributes();
996 for (
const QXmlStreamAttribute &attribute : attributes) {
997 const auto name = attribute.name();
998 if (name == u"name"_s) {
999 setAttributeName(attribute.value().toString());
1002 reader.raiseError(
"Unexpected attribute "_L1 + name);
1005 while (!reader.hasError()) {
1006 switch (reader.readNext()) {
1007 case QXmlStreamReader::StartElement : {
1008 const auto tag = reader.name();
1009 if (!tag.compare(u"property"_s, Qt::CaseInsensitive)) {
1010 auto *v =
new DomProperty();
1012 m_property.append(v);
1015 if (!tag.compare(u"attribute"_s, Qt::CaseInsensitive)) {
1016 auto *v =
new DomProperty();
1018 m_attribute.append(v);
1021 reader.raiseError(
"Unexpected element "_L1 + tag);
1024 case QXmlStreamReader::EndElement :
1032void DomButtonGroup::write(QXmlStreamWriter &writer,
const QString &tagName)
const
1034 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"buttongroup") : tagName.toLower());
1036 if (hasAttributeName())
1037 writer.writeAttribute(u"name"_s, attributeName());
1039 for (DomProperty *v : m_property)
1040 v->write(writer, u"property"_s);
1042 for (DomProperty *v : m_attribute)
1043 v->write(writer, u"attribute"_s);
1045 writer.writeEndElement();
1048void DomButtonGroup::setElementProperty(
const QList<DomProperty *> &a)
1050 m_children |= Property;
1054void DomButtonGroup::setElementAttribute(
const QList<DomProperty *> &a)
1056 m_children |= Attribute;
1060DomButtonGroups::~DomButtonGroups()
1062 qDeleteAll(m_buttonGroup);
1063 m_buttonGroup.clear();
1066void DomButtonGroups::read(QXmlStreamReader &reader)
1068 while (!reader.hasError()) {
1069 switch (reader.readNext()) {
1070 case QXmlStreamReader::StartElement : {
1071 const auto tag = reader.name();
1072 if (!tag.compare(u"buttongroup"_s, Qt::CaseInsensitive)) {
1073 auto *v =
new DomButtonGroup();
1075 m_buttonGroup.append(v);
1078 reader.raiseError(
"Unexpected element "_L1 + tag);
1081 case QXmlStreamReader::EndElement :
1089void DomButtonGroups::write(QXmlStreamWriter &writer,
const QString &tagName)
const
1091 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"buttongroups") : tagName.toLower());
1093 for (DomButtonGroup *v : m_buttonGroup)
1094 v->write(writer, u"buttongroup"_s);
1096 writer.writeEndElement();
1099void DomButtonGroups::setElementButtonGroup(
const QList<DomButtonGroup *> &a)
1101 m_children |= ButtonGroup;
1105DomCustomWidgets::~DomCustomWidgets()
1107 qDeleteAll(m_customWidget);
1108 m_customWidget.clear();
1111void DomCustomWidgets::read(QXmlStreamReader &reader)
1113 while (!reader.hasError()) {
1114 switch (reader.readNext()) {
1115 case QXmlStreamReader::StartElement : {
1116 const auto tag = reader.name();
1117 if (!tag.compare(u"customwidget"_s, Qt::CaseInsensitive)) {
1118 auto *v =
new DomCustomWidget();
1120 m_customWidget.append(v);
1123 reader.raiseError(
"Unexpected element "_L1 + tag);
1126 case QXmlStreamReader::EndElement :
1134void DomCustomWidgets::write(QXmlStreamWriter &writer,
const QString &tagName)
const
1136 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"customwidgets") : tagName.toLower());
1138 for (DomCustomWidget *v : m_customWidget)
1139 v->write(writer, u"customwidget"_s);
1141 writer.writeEndElement();
1144void DomCustomWidgets::setElementCustomWidget(
const QList<DomCustomWidget *> &a)
1146 m_children |= CustomWidget;
1150DomHeader::~DomHeader() =
default;
1152void DomHeader::read(QXmlStreamReader &reader)
1154 const QXmlStreamAttributes &attributes = reader.attributes();
1155 for (
const QXmlStreamAttribute &attribute : attributes) {
1156 const auto name = attribute.name();
1157 if (name == u"location"_s) {
1158 setAttributeLocation(attribute.value().toString());
1161 reader.raiseError(
"Unexpected attribute "_L1 + name);
1164 while (!reader.hasError()) {
1165 switch (reader.readNext()) {
1166 case QXmlStreamReader::StartElement : {
1167 const auto tag = reader.name();
1168 reader.raiseError(
"Unexpected element "_L1 + tag);
1171 case QXmlStreamReader::EndElement :
1173 case QXmlStreamReader::Characters :
1174 if (!reader.isWhitespace())
1175 m_text.append(reader.text().toString());
1183void DomHeader::write(QXmlStreamWriter &writer,
const QString &tagName)
const
1185 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"header") : tagName.toLower());
1187 if (hasAttributeLocation())
1188 writer.writeAttribute(u"location"_s, attributeLocation());
1190 if (!m_text.isEmpty())
1191 writer.writeCharacters(m_text);
1193 writer.writeEndElement();
1196DomCustomWidget::~DomCustomWidget()
1201 delete m_propertyspecifications;
1204void DomCustomWidget::read(QXmlStreamReader &reader)
1206 while (!reader.hasError()) {
1207 switch (reader.readNext()) {
1208 case QXmlStreamReader::StartElement : {
1209 const auto tag = reader.name();
1210 if (!tag.compare(u"class"_s, Qt::CaseInsensitive)) {
1211 setElementClass(reader.readElementText());
1214 if (!tag.compare(u"extends"_s, Qt::CaseInsensitive)) {
1215 setElementExtends(reader.readElementText());
1218 if (!tag.compare(u"header"_s, Qt::CaseInsensitive)) {
1219 auto *v =
new DomHeader();
1221 setElementHeader(v);
1224 if (!tag.compare(u"sizehint"_s, Qt::CaseInsensitive)) {
1225 auto *v =
new DomSize();
1227 setElementSizeHint(v);
1230 if (!tag.compare(u"addpagemethod"_s, Qt::CaseInsensitive)) {
1231 setElementAddPageMethod(reader.readElementText());
1234 if (!tag.compare(u"container"_s, Qt::CaseInsensitive)) {
1235 setElementContainer(reader.readElementText().toInt());
1238 if (!tag.compare(u"sizepolicy"_s, Qt::CaseInsensitive)) {
1239 qWarning(
"Omitting deprecated element <sizepolicy>.");
1240 reader.skipCurrentElement();
1243 if (!tag.compare(u"pixmap"_s, Qt::CaseInsensitive)) {
1244 setElementPixmap(reader.readElementText());
1247 if (!tag.compare(u"script"_s, Qt::CaseInsensitive)) {
1248 qWarning(
"Omitting deprecated element <script>.");
1249 reader.skipCurrentElement();
1252 if (!tag.compare(u"properties"_s, Qt::CaseInsensitive)) {
1253 qWarning(
"Omitting deprecated element <properties>.");
1254 reader.skipCurrentElement();
1257 if (!tag.compare(u"slots"_s, Qt::CaseInsensitive)) {
1258 auto *v =
new DomSlots();
1263 if (!tag.compare(u"propertyspecifications"_s, Qt::CaseInsensitive)) {
1264 auto *v =
new DomPropertySpecifications();
1266 setElementPropertyspecifications(v);
1269 reader.raiseError(
"Unexpected element "_L1 + tag);
1272 case QXmlStreamReader::EndElement :
1280void DomCustomWidget::write(QXmlStreamWriter &writer,
const QString &tagName)
const
1282 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"customwidget") : tagName.toLower());
1284 if (m_children & Class)
1285 writer.writeTextElement(u"class"_s, m_class);
1287 if (m_children & Extends)
1288 writer.writeTextElement(u"extends"_s, m_extends);
1290 if (m_children & Header)
1291 m_header->write(writer, u"header"_s);
1293 if (m_children & SizeHint)
1294 m_sizeHint->write(writer, u"sizehint"_s);
1296 if (m_children & AddPageMethod)
1297 writer.writeTextElement(u"addpagemethod"_s, m_addPageMethod);
1299 if (m_children & Container)
1300 writer.writeTextElement(u"container"_s, QString::number(m_container));
1302 if (m_children & Pixmap)
1303 writer.writeTextElement(u"pixmap"_s, m_pixmap);
1305 if (m_children & Slots)
1306 m_slots->write(writer, u"slots"_s);
1308 if (m_children & Propertyspecifications)
1309 m_propertyspecifications->write(writer, u"propertyspecifications"_s);
1311 writer.writeEndElement();
1314void DomCustomWidget::setElementClass(
const QString &a)
1316 m_children |= Class;
1320void DomCustomWidget::setElementExtends(
const QString &a)
1322 m_children |= Extends;
1326DomHeader *DomCustomWidget::takeElementHeader()
1328 DomHeader *a = m_header;
1330 m_children ^= Header;
1334void DomCustomWidget::setElementHeader(DomHeader *a)
1337 m_children |= Header;
1341DomSize *DomCustomWidget::takeElementSizeHint()
1343 DomSize *a = m_sizeHint;
1344 m_sizeHint =
nullptr;
1345 m_children ^= SizeHint;
1349void DomCustomWidget::setElementSizeHint(DomSize *a)
1352 m_children |= SizeHint;
1356void DomCustomWidget::setElementAddPageMethod(
const QString &a)
1358 m_children |= AddPageMethod;
1359 m_addPageMethod = a;
1362void DomCustomWidget::setElementContainer(
int a)
1364 m_children |= Container;
1368void DomCustomWidget::setElementPixmap(
const QString &a)
1370 m_children |= Pixmap;
1374DomSlots *DomCustomWidget::takeElementSlots()
1376 DomSlots *a = m_slots;
1378 m_children ^= Slots;
1382void DomCustomWidget::setElementSlots(DomSlots *a)
1385 m_children |= Slots;
1389DomPropertySpecifications *DomCustomWidget::takeElementPropertyspecifications()
1391 DomPropertySpecifications *a = m_propertyspecifications;
1392 m_propertyspecifications =
nullptr;
1393 m_children ^= Propertyspecifications;
1397void DomCustomWidget::setElementPropertyspecifications(DomPropertySpecifications *a)
1399 delete m_propertyspecifications;
1400 m_children |= Propertyspecifications;
1401 m_propertyspecifications = a;
1404void DomCustomWidget::clearElementClass()
1406 m_children &= ~Class;
1409void DomCustomWidget::clearElementExtends()
1411 m_children &= ~Extends;
1414void DomCustomWidget::clearElementHeader()
1418 m_children &= ~Header;
1421void DomCustomWidget::clearElementSizeHint()
1424 m_sizeHint =
nullptr;
1425 m_children &= ~SizeHint;
1428void DomCustomWidget::clearElementAddPageMethod()
1430 m_children &= ~AddPageMethod;
1433void DomCustomWidget::clearElementContainer()
1435 m_children &= ~Container;
1438void DomCustomWidget::clearElementPixmap()
1440 m_children &= ~Pixmap;
1443void DomCustomWidget::clearElementSlots()
1447 m_children &= ~Slots;
1450void DomCustomWidget::clearElementPropertyspecifications()
1452 delete m_propertyspecifications;
1453 m_propertyspecifications =
nullptr;
1454 m_children &= ~Propertyspecifications;
1457DomLayoutDefault::~DomLayoutDefault() =
default;
1459void DomLayoutDefault::read(QXmlStreamReader &reader)
1461 const QXmlStreamAttributes &attributes = reader.attributes();
1462 for (
const QXmlStreamAttribute &attribute : attributes) {
1463 const auto name = attribute.name();
1464 if (name == u"spacing"_s) {
1465 setAttributeSpacing(attribute.value().toInt());
1468 if (name == u"margin"_s) {
1469 setAttributeMargin(attribute.value().toInt());
1472 reader.raiseError(
"Unexpected attribute "_L1 + name);
1475 while (!reader.hasError()) {
1476 switch (reader.readNext()) {
1477 case QXmlStreamReader::StartElement : {
1478 const auto tag = reader.name();
1479 reader.raiseError(
"Unexpected element "_L1 + tag);
1482 case QXmlStreamReader::EndElement :
1490void DomLayoutDefault::write(QXmlStreamWriter &writer,
const QString &tagName)
const
1492 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"layoutdefault") : tagName.toLower());
1494 if (hasAttributeSpacing())
1495 writer.writeAttribute(u"spacing"_s, QString::number(attributeSpacing()));
1497 if (hasAttributeMargin())
1498 writer.writeAttribute(u"margin"_s, QString::number(attributeMargin()));
1500 writer.writeEndElement();
1503DomLayoutFunction::~DomLayoutFunction() =
default;
1505void DomLayoutFunction::read(QXmlStreamReader &reader)
1507 const QXmlStreamAttributes &attributes = reader.attributes();
1508 for (
const QXmlStreamAttribute &attribute : attributes) {
1509 const auto name = attribute.name();
1510 if (name == u"spacing"_s) {
1511 setAttributeSpacing(attribute.value().toString());
1514 if (name == u"margin"_s) {
1515 setAttributeMargin(attribute.value().toString());
1518 reader.raiseError(
"Unexpected attribute "_L1 + name);
1521 while (!reader.hasError()) {
1522 switch (reader.readNext()) {
1523 case QXmlStreamReader::StartElement : {
1524 const auto tag = reader.name();
1525 reader.raiseError(
"Unexpected element "_L1 + tag);
1528 case QXmlStreamReader::EndElement :
1536void DomLayoutFunction::write(QXmlStreamWriter &writer,
const QString &tagName)
const
1538 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"layoutfunction") : tagName.toLower());
1540 if (hasAttributeSpacing())
1541 writer.writeAttribute(u"spacing"_s, attributeSpacing());
1543 if (hasAttributeMargin())
1544 writer.writeAttribute(u"margin"_s, attributeMargin());
1546 writer.writeEndElement();
1549DomTabStops::~DomTabStops()
1554void DomTabStops::read(QXmlStreamReader &reader)
1556 while (!reader.hasError()) {
1557 switch (reader.readNext()) {
1558 case QXmlStreamReader::StartElement : {
1559 const auto tag = reader.name();
1560 if (!tag.compare(u"tabstop"_s, Qt::CaseInsensitive)) {
1561 m_tabStop.append(reader.readElementText());
1564 reader.raiseError(
"Unexpected element "_L1 + tag);
1567 case QXmlStreamReader::EndElement :
1575void DomTabStops::write(QXmlStreamWriter &writer,
const QString &tagName)
const
1577 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"tabstops") : tagName.toLower());
1579 for (
const QString &v : m_tabStop)
1580 writer.writeTextElement(u"tabstop"_s, v);
1582 writer.writeEndElement();
1585void DomTabStops::setElementTabStop(
const QStringList &a)
1587 m_children |= TabStop;
1591DomLayout::~DomLayout()
1593 qDeleteAll(m_property);
1595 qDeleteAll(m_attribute);
1596 m_attribute.clear();
1601void DomLayout::read(QXmlStreamReader &reader)
1603 const QXmlStreamAttributes &attributes = reader.attributes();
1604 for (
const QXmlStreamAttribute &attribute : attributes) {
1605 const auto name = attribute.name();
1606 if (name == u"class"_s) {
1607 setAttributeClass(attribute.value().toString());
1610 if (name == u"name"_s) {
1611 setAttributeName(attribute.value().toString());
1614 if (name == u"stretch"_s) {
1615 setAttributeStretch(attribute.value().toString());
1618 if (name == u"rowstretch"_s) {
1619 setAttributeRowStretch(attribute.value().toString());
1622 if (name == u"columnstretch"_s) {
1623 setAttributeColumnStretch(attribute.value().toString());
1626 if (name == u"rowminimumheight"_s) {
1627 setAttributeRowMinimumHeight(attribute.value().toString());
1630 if (name == u"columnminimumwidth"_s) {
1631 setAttributeColumnMinimumWidth(attribute.value().toString());
1634 reader.raiseError(
"Unexpected attribute "_L1 + name);
1637 while (!reader.hasError()) {
1638 switch (reader.readNext()) {
1639 case QXmlStreamReader::StartElement : {
1640 const auto tag = reader.name();
1641 if (!tag.compare(u"property"_s, Qt::CaseInsensitive)) {
1642 auto *v =
new DomProperty();
1644 m_property.append(v);
1647 if (!tag.compare(u"attribute"_s, Qt::CaseInsensitive)) {
1648 auto *v =
new DomProperty();
1650 m_attribute.append(v);
1653 if (!tag.compare(u"item"_s, Qt::CaseInsensitive)) {
1654 auto *v =
new DomLayoutItem();
1659 reader.raiseError(
"Unexpected element "_L1 + tag);
1662 case QXmlStreamReader::EndElement :
1670void DomLayout::write(QXmlStreamWriter &writer,
const QString &tagName)
const
1672 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"layout") : tagName.toLower());
1674 if (hasAttributeClass())
1675 writer.writeAttribute(u"class"_s, attributeClass());
1677 if (hasAttributeName())
1678 writer.writeAttribute(u"name"_s, attributeName());
1680 if (hasAttributeStretch())
1681 writer.writeAttribute(u"stretch"_s, attributeStretch());
1683 if (hasAttributeRowStretch())
1684 writer.writeAttribute(u"rowstretch"_s, attributeRowStretch());
1686 if (hasAttributeColumnStretch())
1687 writer.writeAttribute(u"columnstretch"_s, attributeColumnStretch());
1689 if (hasAttributeRowMinimumHeight())
1690 writer.writeAttribute(u"rowminimumheight"_s, attributeRowMinimumHeight());
1692 if (hasAttributeColumnMinimumWidth())
1693 writer.writeAttribute(u"columnminimumwidth"_s, attributeColumnMinimumWidth());
1695 for (DomProperty *v : m_property)
1696 v->write(writer, u"property"_s);
1698 for (DomProperty *v : m_attribute)
1699 v->write(writer, u"attribute"_s);
1701 for (DomLayoutItem *v : m_item)
1702 v->write(writer, u"item"_s);
1704 writer.writeEndElement();
1707void DomLayout::setElementProperty(
const QList<DomProperty *> &a)
1709 m_children |= Property;
1713void DomLayout::setElementAttribute(
const QList<DomProperty *> &a)
1715 m_children |= Attribute;
1719void DomLayout::setElementItem(
const QList<DomLayoutItem *> &a)
1725DomLayoutItem::~DomLayoutItem()
1732void DomLayoutItem::clear()
1745void DomLayoutItem::read(QXmlStreamReader &reader)
1747 const QXmlStreamAttributes &attributes = reader.attributes();
1748 for (
const QXmlStreamAttribute &attribute : attributes) {
1749 const auto name = attribute.name();
1750 if (name == u"row"_s) {
1751 setAttributeRow(attribute.value().toInt());
1754 if (name == u"column"_s) {
1755 setAttributeColumn(attribute.value().toInt());
1758 if (name == u"rowspan"_s) {
1759 setAttributeRowSpan(attribute.value().toInt());
1762 if (name == u"colspan"_s) {
1763 setAttributeColSpan(attribute.value().toInt());
1766 if (name == u"alignment"_s) {
1767 setAttributeAlignment(attribute.value().toString());
1770 reader.raiseError(
"Unexpected attribute "_L1 + name);
1773 while (!reader.hasError()) {
1774 switch (reader.readNext()) {
1775 case QXmlStreamReader::StartElement : {
1776 const auto tag = reader.name();
1777 if (!tag.compare(u"widget"_s, Qt::CaseInsensitive)) {
1778 auto *v =
new DomWidget();
1780 setElementWidget(v);
1783 if (!tag.compare(u"layout"_s, Qt::CaseInsensitive)) {
1784 auto *v =
new DomLayout();
1786 setElementLayout(v);
1789 if (!tag.compare(u"spacer"_s, Qt::CaseInsensitive)) {
1790 auto *v =
new DomSpacer();
1792 setElementSpacer(v);
1795 reader.raiseError(
"Unexpected element "_L1 + tag);
1798 case QXmlStreamReader::EndElement :
1806void DomLayoutItem::write(QXmlStreamWriter &writer,
const QString &tagName)
const
1808 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"layoutitem") : tagName.toLower());
1810 if (hasAttributeRow())
1811 writer.writeAttribute(u"row"_s, QString::number(attributeRow()));
1813 if (hasAttributeColumn())
1814 writer.writeAttribute(u"column"_s, QString::number(attributeColumn()));
1816 if (hasAttributeRowSpan())
1817 writer.writeAttribute(u"rowspan"_s, QString::number(attributeRowSpan()));
1819 if (hasAttributeColSpan())
1820 writer.writeAttribute(u"colspan"_s, QString::number(attributeColSpan()));
1822 if (hasAttributeAlignment())
1823 writer.writeAttribute(u"alignment"_s, attributeAlignment());
1827 if (m_widget !=
nullptr)
1828 m_widget->write(writer, u"widget"_s);
1832 if (m_layout !=
nullptr)
1833 m_layout->write(writer, u"layout"_s);
1837 if (m_spacer !=
nullptr)
1838 m_spacer->write(writer, u"spacer"_s);
1844 writer.writeEndElement();
1847DomWidget *DomLayoutItem::takeElementWidget()
1849 DomWidget *a = m_widget;
1854void DomLayoutItem::setElementWidget(DomWidget *a)
1861DomLayout *DomLayoutItem::takeElementLayout()
1863 DomLayout *a = m_layout;
1868void DomLayoutItem::setElementLayout(DomLayout *a)
1875DomSpacer *DomLayoutItem::takeElementSpacer()
1877 DomSpacer *a = m_spacer;
1882void DomLayoutItem::setElementSpacer(DomSpacer *a)
1891 qDeleteAll(m_property);
1895void DomRow::read(QXmlStreamReader &reader)
1897 while (!reader.hasError()) {
1898 switch (reader.readNext()) {
1899 case QXmlStreamReader::StartElement : {
1900 const auto tag = reader.name();
1901 if (!tag.compare(u"property"_s, Qt::CaseInsensitive)) {
1902 auto *v =
new DomProperty();
1904 m_property.append(v);
1907 reader.raiseError(
"Unexpected element "_L1 + tag);
1910 case QXmlStreamReader::EndElement :
1918void DomRow::write(QXmlStreamWriter &writer,
const QString &tagName)
const
1920 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"row") : tagName.toLower());
1922 for (DomProperty *v : m_property)
1923 v->write(writer, u"property"_s);
1925 writer.writeEndElement();
1928void DomRow::setElementProperty(
const QList<DomProperty *> &a)
1930 m_children |= Property;
1934DomColumn::~DomColumn()
1936 qDeleteAll(m_property);
1940void DomColumn::read(QXmlStreamReader &reader)
1942 while (!reader.hasError()) {
1943 switch (reader.readNext()) {
1944 case QXmlStreamReader::StartElement : {
1945 const auto tag = reader.name();
1946 if (!tag.compare(u"property"_s, Qt::CaseInsensitive)) {
1947 auto *v =
new DomProperty();
1949 m_property.append(v);
1952 reader.raiseError(
"Unexpected element "_L1 + tag);
1955 case QXmlStreamReader::EndElement :
1963void DomColumn::write(QXmlStreamWriter &writer,
const QString &tagName)
const
1965 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"column") : tagName.toLower());
1967 for (DomProperty *v : m_property)
1968 v->write(writer, u"property"_s);
1970 writer.writeEndElement();
1973void DomColumn::setElementProperty(
const QList<DomProperty *> &a)
1975 m_children |= Property;
1981 qDeleteAll(m_property);
1987void DomItem::read(QXmlStreamReader &reader)
1989 const QXmlStreamAttributes &attributes = reader.attributes();
1990 for (
const QXmlStreamAttribute &attribute : attributes) {
1991 const auto name = attribute.name();
1992 if (name == u"row"_s) {
1993 setAttributeRow(attribute.value().toInt());
1996 if (name == u"column"_s) {
1997 setAttributeColumn(attribute.value().toInt());
2000 reader.raiseError(
"Unexpected attribute "_L1 + name);
2003 while (!reader.hasError()) {
2004 switch (reader.readNext()) {
2005 case QXmlStreamReader::StartElement : {
2006 const auto tag = reader.name();
2007 if (!tag.compare(u"property"_s, Qt::CaseInsensitive)) {
2008 auto *v =
new DomProperty();
2010 m_property.append(v);
2013 if (!tag.compare(u"item"_s, Qt::CaseInsensitive)) {
2014 auto *v =
new DomItem();
2019 reader.raiseError(
"Unexpected element "_L1 + tag);
2022 case QXmlStreamReader::EndElement :
2030void DomItem::write(QXmlStreamWriter &writer,
const QString &tagName)
const
2032 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"item") : tagName.toLower());
2034 if (hasAttributeRow())
2035 writer.writeAttribute(u"row"_s, QString::number(attributeRow()));
2037 if (hasAttributeColumn())
2038 writer.writeAttribute(u"column"_s, QString::number(attributeColumn()));
2040 for (DomProperty *v : m_property)
2041 v->write(writer, u"property"_s);
2043 for (DomItem *v : m_item)
2044 v->write(writer, u"item"_s);
2046 writer.writeEndElement();
2049void DomItem::setElementProperty(
const QList<DomProperty *> &a)
2051 m_children |= Property;
2055void DomItem::setElementItem(
const QList<DomItem *> &a)
2061DomWidget::~DomWidget()
2064 qDeleteAll(m_property);
2066 qDeleteAll(m_attribute);
2067 m_attribute.clear();
2070 qDeleteAll(m_column);
2074 qDeleteAll(m_layout);
2076 qDeleteAll(m_widget);
2078 qDeleteAll(m_action);
2080 qDeleteAll(m_actionGroup);
2081 m_actionGroup.clear();
2082 qDeleteAll(m_addAction);
2083 m_addAction.clear();
2087void DomWidget::read(QXmlStreamReader &reader)
2089 const QXmlStreamAttributes &attributes = reader.attributes();
2090 for (
const QXmlStreamAttribute &attribute : attributes) {
2091 const auto name = attribute.name();
2092 if (name == u"class"_s) {
2093 setAttributeClass(attribute.value().toString());
2096 if (name == u"name"_s) {
2097 setAttributeName(attribute.value().toString());
2100 if (name == u"native"_s) {
2101 setAttributeNative(attribute.value() == u"true"_s);
2104 reader.raiseError(
"Unexpected attribute "_L1 + name);
2107 while (!reader.hasError()) {
2108 switch (reader.readNext()) {
2109 case QXmlStreamReader::StartElement : {
2110 const auto tag = reader.name();
2111 if (!tag.compare(u"class"_s, Qt::CaseInsensitive)) {
2112 m_class.append(reader.readElementText());
2115 if (!tag.compare(u"property"_s, Qt::CaseInsensitive)) {
2116 auto *v =
new DomProperty();
2118 m_property.append(v);
2121 if (!tag.compare(u"script"_s, Qt::CaseInsensitive)) {
2122 qWarning(
"Omitting deprecated element <script>.");
2123 reader.skipCurrentElement();
2126 if (!tag.compare(u"widgetdata"_s, Qt::CaseInsensitive)) {
2127 qWarning(
"Omitting deprecated element <widgetdata>.");
2128 reader.skipCurrentElement();
2131 if (!tag.compare(u"attribute"_s, Qt::CaseInsensitive)) {
2132 auto *v =
new DomProperty();
2134 m_attribute.append(v);
2137 if (!tag.compare(u"row"_s, Qt::CaseInsensitive)) {
2138 auto *v =
new DomRow();
2143 if (!tag.compare(u"column"_s, Qt::CaseInsensitive)) {
2144 auto *v =
new DomColumn();
2149 if (!tag.compare(u"item"_s, Qt::CaseInsensitive)) {
2150 auto *v =
new DomItem();
2155 if (!tag.compare(u"layout"_s, Qt::CaseInsensitive)) {
2156 auto *v =
new DomLayout();
2161 if (!tag.compare(u"widget"_s, Qt::CaseInsensitive)) {
2162 auto *v =
new DomWidget();
2167 if (!tag.compare(u"action"_s, Qt::CaseInsensitive)) {
2168 auto *v =
new DomAction();
2173 if (!tag.compare(u"actiongroup"_s, Qt::CaseInsensitive)) {
2174 auto *v =
new DomActionGroup();
2176 m_actionGroup.append(v);
2179 if (!tag.compare(u"addaction"_s, Qt::CaseInsensitive)) {
2180 auto *v =
new DomActionRef();
2182 m_addAction.append(v);
2185 if (!tag.compare(u"zorder"_s, Qt::CaseInsensitive)) {
2186 m_zOrder.append(reader.readElementText());
2189 reader.raiseError(
"Unexpected element "_L1 + tag);
2192 case QXmlStreamReader::EndElement :
2200void DomWidget::write(QXmlStreamWriter &writer,
const QString &tagName)
const
2202 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"widget") : tagName.toLower());
2204 if (hasAttributeClass())
2205 writer.writeAttribute(u"class"_s, attributeClass());
2207 if (hasAttributeName())
2208 writer.writeAttribute(u"name"_s, attributeName());
2210 if (hasAttributeNative())
2211 writer.writeAttribute(u"native"_s, (attributeNative() ? u"true"_s : u"false"_s));
2213 for (
const QString &v : m_class)
2214 writer.writeTextElement(u"class"_s, v);
2216 for (DomProperty *v : m_property)
2217 v->write(writer, u"property"_s);
2219 for (DomProperty *v : m_attribute)
2220 v->write(writer, u"attribute"_s);
2222 for (DomRow *v : m_row)
2223 v->write(writer, u"row"_s);
2225 for (DomColumn *v : m_column)
2226 v->write(writer, u"column"_s);
2228 for (DomItem *v : m_item)
2229 v->write(writer, u"item"_s);
2231 for (DomLayout *v : m_layout)
2232 v->write(writer, u"layout"_s);
2234 for (DomWidget *v : m_widget)
2235 v->write(writer, u"widget"_s);
2237 for (DomAction *v : m_action)
2238 v->write(writer, u"action"_s);
2240 for (DomActionGroup *v : m_actionGroup)
2241 v->write(writer, u"actiongroup"_s);
2243 for (DomActionRef *v : m_addAction)
2244 v->write(writer, u"addaction"_s);
2246 for (
const QString &v : m_zOrder)
2247 writer.writeTextElement(u"zorder"_s, v);
2249 writer.writeEndElement();
2252void DomWidget::setElementClass(
const QStringList &a)
2254 m_children |= Class;
2258void DomWidget::setElementProperty(
const QList<DomProperty *> &a)
2260 m_children |= Property;
2264void DomWidget::setElementAttribute(
const QList<DomProperty *> &a)
2266 m_children |= Attribute;
2270void DomWidget::setElementRow(
const QList<DomRow *> &a)
2276void DomWidget::setElementColumn(
const QList<DomColumn *> &a)
2278 m_children |= Column;
2282void DomWidget::setElementItem(
const QList<DomItem *> &a)
2288void DomWidget::setElementLayout(
const QList<DomLayout *> &a)
2290 m_children |= Layout;
2294void DomWidget::setElementWidget(
const QList<DomWidget *> &a)
2296 m_children |= Widget;
2300void DomWidget::setElementAction(
const QList<DomAction *> &a)
2302 m_children |= Action;
2306void DomWidget::setElementActionGroup(
const QList<DomActionGroup *> &a)
2308 m_children |= ActionGroup;
2312void DomWidget::setElementAddAction(
const QList<DomActionRef *> &a)
2314 m_children |= AddAction;
2318void DomWidget::setElementZOrder(
const QStringList &a)
2320 m_children |= ZOrder;
2324DomSpacer::~DomSpacer()
2326 qDeleteAll(m_property);
2330void DomSpacer::read(QXmlStreamReader &reader)
2332 const QXmlStreamAttributes &attributes = reader.attributes();
2333 for (
const QXmlStreamAttribute &attribute : attributes) {
2334 const auto name = attribute.name();
2335 if (name == u"name"_s) {
2336 setAttributeName(attribute.value().toString());
2339 reader.raiseError(
"Unexpected attribute "_L1 + name);
2342 while (!reader.hasError()) {
2343 switch (reader.readNext()) {
2344 case QXmlStreamReader::StartElement : {
2345 const auto tag = reader.name();
2346 if (!tag.compare(u"property"_s, Qt::CaseInsensitive)) {
2347 auto *v =
new DomProperty();
2349 m_property.append(v);
2352 reader.raiseError(
"Unexpected element "_L1 + tag);
2355 case QXmlStreamReader::EndElement :
2363void DomSpacer::write(QXmlStreamWriter &writer,
const QString &tagName)
const
2365 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"spacer") : tagName.toLower());
2367 if (hasAttributeName())
2368 writer.writeAttribute(u"name"_s, attributeName());
2370 for (DomProperty *v : m_property)
2371 v->write(writer, u"property"_s);
2373 writer.writeEndElement();
2376void DomSpacer::setElementProperty(
const QList<DomProperty *> &a)
2378 m_children |= Property;
2382DomColor::~DomColor() =
default;
2384void DomColor::read(QXmlStreamReader &reader)
2386 const QXmlStreamAttributes &attributes = reader.attributes();
2387 for (
const QXmlStreamAttribute &attribute : attributes) {
2388 const auto name = attribute.name();
2389 if (name == u"alpha"_s) {
2390 setAttributeAlpha(attribute.value().toInt());
2393 reader.raiseError(
"Unexpected attribute "_L1 + name);
2396 while (!reader.hasError()) {
2397 switch (reader.readNext()) {
2398 case QXmlStreamReader::StartElement : {
2399 const auto tag = reader.name();
2400 if (!tag.compare(u"red"_s, Qt::CaseInsensitive)) {
2401 setElementRed(reader.readElementText().toInt());
2404 if (!tag.compare(u"green"_s, Qt::CaseInsensitive)) {
2405 setElementGreen(reader.readElementText().toInt());
2408 if (!tag.compare(u"blue"_s, Qt::CaseInsensitive)) {
2409 setElementBlue(reader.readElementText().toInt());
2412 reader.raiseError(
"Unexpected element "_L1 + tag);
2415 case QXmlStreamReader::EndElement :
2423void DomColor::write(QXmlStreamWriter &writer,
const QString &tagName)
const
2425 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"color") : tagName.toLower());
2427 if (hasAttributeAlpha())
2428 writer.writeAttribute(u"alpha"_s, QString::number(attributeAlpha()));
2430 if (m_children & Red)
2431 writer.writeTextElement(u"red"_s, QString::number(m_red));
2433 if (m_children & Green)
2434 writer.writeTextElement(u"green"_s, QString::number(m_green));
2436 if (m_children & Blue)
2437 writer.writeTextElement(u"blue"_s, QString::number(m_blue));
2439 writer.writeEndElement();
2442void DomColor::setElementRed(
int a)
2448void DomColor::setElementGreen(
int a)
2450 m_children |= Green;
2454void DomColor::setElementBlue(
int a)
2460void DomColor::clearElementRed()
2465void DomColor::clearElementGreen()
2467 m_children &= ~Green;
2470void DomColor::clearElementBlue()
2472 m_children &= ~Blue;
2475DomGradientStop::~DomGradientStop()
2480void DomGradientStop::read(QXmlStreamReader &reader)
2482 const QXmlStreamAttributes &attributes = reader.attributes();
2483 for (
const QXmlStreamAttribute &attribute : attributes) {
2484 const auto name = attribute.name();
2485 if (name == u"position"_s) {
2486 setAttributePosition(attribute.value().toDouble());
2489 reader.raiseError(
"Unexpected attribute "_L1 + name);
2492 while (!reader.hasError()) {
2493 switch (reader.readNext()) {
2494 case QXmlStreamReader::StartElement : {
2495 const auto tag = reader.name();
2496 if (!tag.compare(u"color"_s, Qt::CaseInsensitive)) {
2497 auto *v =
new DomColor();
2502 reader.raiseError(
"Unexpected element "_L1 + tag);
2505 case QXmlStreamReader::EndElement :
2513void DomGradientStop::write(QXmlStreamWriter &writer,
const QString &tagName)
const
2515 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"gradientstop") : tagName.toLower());
2517 if (hasAttributePosition())
2518 writer.writeAttribute(u"position"_s, QString::number(attributePosition(),
'f', 15));
2520 if (m_children & Color)
2521 m_color->write(writer, u"color"_s);
2523 writer.writeEndElement();
2526DomColor *DomGradientStop::takeElementColor()
2528 DomColor *a = m_color;
2530 m_children ^= Color;
2534void DomGradientStop::setElementColor(DomColor *a)
2537 m_children |= Color;
2541void DomGradientStop::clearElementColor()
2545 m_children &= ~Color;
2548DomGradient::~DomGradient()
2550 qDeleteAll(m_gradientStop);
2551 m_gradientStop.clear();
2554void DomGradient::read(QXmlStreamReader &reader)
2556 const QXmlStreamAttributes &attributes = reader.attributes();
2557 for (
const QXmlStreamAttribute &attribute : attributes) {
2558 const auto name = attribute.name();
2559 if (name == u"startx"_s) {
2560 setAttributeStartX(attribute.value().toDouble());
2563 if (name == u"starty"_s) {
2564 setAttributeStartY(attribute.value().toDouble());
2567 if (name == u"endx"_s) {
2568 setAttributeEndX(attribute.value().toDouble());
2571 if (name == u"endy"_s) {
2572 setAttributeEndY(attribute.value().toDouble());
2575 if (name == u"centralx"_s) {
2576 setAttributeCentralX(attribute.value().toDouble());
2579 if (name == u"centraly"_s) {
2580 setAttributeCentralY(attribute.value().toDouble());
2583 if (name == u"focalx"_s) {
2584 setAttributeFocalX(attribute.value().toDouble());
2587 if (name == u"focaly"_s) {
2588 setAttributeFocalY(attribute.value().toDouble());
2591 if (name == u"radius"_s) {
2592 setAttributeRadius(attribute.value().toDouble());
2595 if (name == u"angle"_s) {
2596 setAttributeAngle(attribute.value().toDouble());
2599 if (name == u"type"_s) {
2600 setAttributeType(attribute.value().toString());
2603 if (name == u"spread"_s) {
2604 setAttributeSpread(attribute.value().toString());
2607 if (name == u"coordinatemode"_s) {
2608 setAttributeCoordinateMode(attribute.value().toString());
2611 reader.raiseError(
"Unexpected attribute "_L1 + name);
2614 while (!reader.hasError()) {
2615 switch (reader.readNext()) {
2616 case QXmlStreamReader::StartElement : {
2617 const auto tag = reader.name();
2618 if (!tag.compare(u"gradientstop"_s, Qt::CaseInsensitive)) {
2619 auto *v =
new DomGradientStop();
2621 m_gradientStop.append(v);
2624 reader.raiseError(
"Unexpected element "_L1 + tag);
2627 case QXmlStreamReader::EndElement :
2635void DomGradient::write(QXmlStreamWriter &writer,
const QString &tagName)
const
2637 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"gradient") : tagName.toLower());
2639 if (hasAttributeStartX())
2640 writer.writeAttribute(u"startx"_s, QString::number(attributeStartX(),
'f', 15));
2642 if (hasAttributeStartY())
2643 writer.writeAttribute(u"starty"_s, QString::number(attributeStartY(),
'f', 15));
2645 if (hasAttributeEndX())
2646 writer.writeAttribute(u"endx"_s, QString::number(attributeEndX(),
'f', 15));
2648 if (hasAttributeEndY())
2649 writer.writeAttribute(u"endy"_s, QString::number(attributeEndY(),
'f', 15));
2651 if (hasAttributeCentralX())
2652 writer.writeAttribute(u"centralx"_s, QString::number(attributeCentralX(),
'f', 15));
2654 if (hasAttributeCentralY())
2655 writer.writeAttribute(u"centraly"_s, QString::number(attributeCentralY(),
'f', 15));
2657 if (hasAttributeFocalX())
2658 writer.writeAttribute(u"focalx"_s, QString::number(attributeFocalX(),
'f', 15));
2660 if (hasAttributeFocalY())
2661 writer.writeAttribute(u"focaly"_s, QString::number(attributeFocalY(),
'f', 15));
2663 if (hasAttributeRadius())
2664 writer.writeAttribute(u"radius"_s, QString::number(attributeRadius(),
'f', 15));
2666 if (hasAttributeAngle())
2667 writer.writeAttribute(u"angle"_s, QString::number(attributeAngle(),
'f', 15));
2669 if (hasAttributeType())
2670 writer.writeAttribute(u"type"_s, attributeType());
2672 if (hasAttributeSpread())
2673 writer.writeAttribute(u"spread"_s, attributeSpread());
2675 if (hasAttributeCoordinateMode())
2676 writer.writeAttribute(u"coordinatemode"_s, attributeCoordinateMode());
2678 for (DomGradientStop *v : m_gradientStop)
2679 v->write(writer, u"gradientstop"_s);
2681 writer.writeEndElement();
2684void DomGradient::setElementGradientStop(
const QList<DomGradientStop *> &a)
2686 m_children |= GradientStop;
2690DomBrush::~DomBrush()
2697void DomBrush::clear()
2706 m_texture =
nullptr;
2707 m_gradient =
nullptr;
2710void DomBrush::read(QXmlStreamReader &reader)
2712 const QXmlStreamAttributes &attributes = reader.attributes();
2713 for (
const QXmlStreamAttribute &attribute : attributes) {
2714 const auto name = attribute.name();
2715 if (name == u"brushstyle"_s) {
2716 setAttributeBrushStyle(attribute.value().toString());
2719 reader.raiseError(
"Unexpected attribute "_L1 + name);
2722 while (!reader.hasError()) {
2723 switch (reader.readNext()) {
2724 case QXmlStreamReader::StartElement : {
2725 const auto tag = reader.name();
2726 if (!tag.compare(u"color"_s, Qt::CaseInsensitive)) {
2727 auto *v =
new DomColor();
2732 if (!tag.compare(u"texture"_s, Qt::CaseInsensitive)) {
2733 auto *v =
new DomProperty();
2735 setElementTexture(v);
2738 if (!tag.compare(u"gradient"_s, Qt::CaseInsensitive)) {
2739 auto *v =
new DomGradient();
2741 setElementGradient(v);
2744 reader.raiseError(
"Unexpected element "_L1 + tag);
2747 case QXmlStreamReader::EndElement :
2755void DomBrush::write(QXmlStreamWriter &writer,
const QString &tagName)
const
2757 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"brush") : tagName.toLower());
2759 if (hasAttributeBrushStyle())
2760 writer.writeAttribute(u"brushstyle"_s, attributeBrushStyle());
2764 if (m_color !=
nullptr)
2765 m_color->write(writer, u"color"_s);
2769 if (m_texture !=
nullptr)
2770 m_texture->write(writer, u"texture"_s);
2774 if (m_gradient !=
nullptr)
2775 m_gradient->write(writer, u"gradient"_s);
2781 writer.writeEndElement();
2784DomColor *DomBrush::takeElementColor()
2786 DomColor *a = m_color;
2791void DomBrush::setElementColor(DomColor *a)
2798DomProperty *DomBrush::takeElementTexture()
2800 DomProperty *a = m_texture;
2801 m_texture =
nullptr;
2805void DomBrush::setElementTexture(DomProperty *a)
2812DomGradient *DomBrush::takeElementGradient()
2814 DomGradient *a = m_gradient;
2815 m_gradient =
nullptr;
2819void DomBrush::setElementGradient(DomGradient *a)
2826DomColorRole::~DomColorRole()
2831void DomColorRole::read(QXmlStreamReader &reader)
2833 const QXmlStreamAttributes &attributes = reader.attributes();
2834 for (
const QXmlStreamAttribute &attribute : attributes) {
2835 const auto name = attribute.name();
2836 if (name == u"role"_s) {
2837 setAttributeRole(attribute.value().toString());
2840 reader.raiseError(
"Unexpected attribute "_L1 + name);
2843 while (!reader.hasError()) {
2844 switch (reader.readNext()) {
2845 case QXmlStreamReader::StartElement : {
2846 const auto tag = reader.name();
2847 if (!tag.compare(u"brush"_s, Qt::CaseInsensitive)) {
2848 auto *v =
new DomBrush();
2853 reader.raiseError(
"Unexpected element "_L1 + tag);
2856 case QXmlStreamReader::EndElement :
2864void DomColorRole::write(QXmlStreamWriter &writer,
const QString &tagName)
const
2866 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"colorrole") : tagName.toLower());
2868 if (hasAttributeRole())
2869 writer.writeAttribute(u"role"_s, attributeRole());
2871 if (m_children & Brush)
2872 m_brush->write(writer, u"brush"_s);
2874 writer.writeEndElement();
2877DomBrush *DomColorRole::takeElementBrush()
2879 DomBrush *a = m_brush;
2881 m_children ^= Brush;
2885void DomColorRole::setElementBrush(DomBrush *a)
2888 m_children |= Brush;
2892void DomColorRole::clearElementBrush()
2896 m_children &= ~Brush;
2899DomColorGroup::~DomColorGroup()
2901 qDeleteAll(m_colorRole);
2902 m_colorRole.clear();
2903 qDeleteAll(m_color);
2907void DomColorGroup::read(QXmlStreamReader &reader)
2909 while (!reader.hasError()) {
2910 switch (reader.readNext()) {
2911 case QXmlStreamReader::StartElement : {
2912 const auto tag = reader.name();
2913 if (!tag.compare(u"colorrole"_s, Qt::CaseInsensitive)) {
2914 auto *v =
new DomColorRole();
2916 m_colorRole.append(v);
2919 if (!tag.compare(u"color"_s, Qt::CaseInsensitive)) {
2920 auto *v =
new DomColor();
2925 reader.raiseError(
"Unexpected element "_L1 + tag);
2928 case QXmlStreamReader::EndElement :
2936void DomColorGroup::write(QXmlStreamWriter &writer,
const QString &tagName)
const
2938 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"colorgroup") : tagName.toLower());
2940 for (DomColorRole *v : m_colorRole)
2941 v->write(writer, u"colorrole"_s);
2943 for (DomColor *v : m_color)
2944 v->write(writer, u"color"_s);
2946 writer.writeEndElement();
2949void DomColorGroup::setElementColorRole(
const QList<DomColorRole *> &a)
2951 m_children |= ColorRole;
2955void DomColorGroup::setElementColor(
const QList<DomColor *> &a)
2957 m_children |= Color;
2961DomPalette::~DomPalette()
2968void DomPalette::read(QXmlStreamReader &reader)
2970 while (!reader.hasError()) {
2971 switch (reader.readNext()) {
2972 case QXmlStreamReader::StartElement : {
2973 const auto tag = reader.name();
2974 if (!tag.compare(u"active"_s, Qt::CaseInsensitive)) {
2975 auto *v =
new DomColorGroup();
2977 setElementActive(v);
2980 if (!tag.compare(u"inactive"_s, Qt::CaseInsensitive)) {
2981 auto *v =
new DomColorGroup();
2983 setElementInactive(v);
2986 if (!tag.compare(u"disabled"_s, Qt::CaseInsensitive)) {
2987 auto *v =
new DomColorGroup();
2989 setElementDisabled(v);
2992 reader.raiseError(
"Unexpected element "_L1 + tag);
2995 case QXmlStreamReader::EndElement :
3003void DomPalette::write(QXmlStreamWriter &writer,
const QString &tagName)
const
3005 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"palette") : tagName.toLower());
3007 if (m_children & Active)
3008 m_active->write(writer, u"active"_s);
3010 if (m_children & Inactive)
3011 m_inactive->write(writer, u"inactive"_s);
3013 if (m_children & Disabled)
3014 m_disabled->write(writer, u"disabled"_s);
3016 writer.writeEndElement();
3019DomColorGroup *DomPalette::takeElementActive()
3021 DomColorGroup *a = m_active;
3023 m_children ^= Active;
3027void DomPalette::setElementActive(DomColorGroup *a)
3030 m_children |= Active;
3034DomColorGroup *DomPalette::takeElementInactive()
3036 DomColorGroup *a = m_inactive;
3037 m_inactive =
nullptr;
3038 m_children ^= Inactive;
3042void DomPalette::setElementInactive(DomColorGroup *a)
3045 m_children |= Inactive;
3049DomColorGroup *DomPalette::takeElementDisabled()
3051 DomColorGroup *a = m_disabled;
3052 m_disabled =
nullptr;
3053 m_children ^= Disabled;
3057void DomPalette::setElementDisabled(DomColorGroup *a)
3060 m_children |= Disabled;
3064void DomPalette::clearElementActive()
3068 m_children &= ~Active;
3071void DomPalette::clearElementInactive()
3074 m_inactive =
nullptr;
3075 m_children &= ~Inactive;
3078void DomPalette::clearElementDisabled()
3081 m_disabled =
nullptr;
3082 m_children &= ~Disabled;
3085DomFont::~DomFont() =
default;
3087void DomFont::read(QXmlStreamReader &reader)
3089 while (!reader.hasError()) {
3090 switch (reader.readNext()) {
3091 case QXmlStreamReader::StartElement : {
3092 const auto tag = reader.name();
3093 if (!tag.compare(u"family"_s, Qt::CaseInsensitive)) {
3094 setElementFamily(reader.readElementText());
3097 if (!tag.compare(u"pointsize"_s, Qt::CaseInsensitive)) {
3098 setElementPointSize(reader.readElementText().toInt());
3101 if (!tag.compare(u"weight"_s, Qt::CaseInsensitive)) {
3102 setElementWeight(reader.readElementText().toInt());
3105 if (!tag.compare(u"italic"_s, Qt::CaseInsensitive)) {
3106 setElementItalic(reader.readElementText() == u"true"_s);
3109 if (!tag.compare(u"bold"_s, Qt::CaseInsensitive)) {
3110 setElementBold(reader.readElementText() == u"true"_s);
3113 if (!tag.compare(u"underline"_s, Qt::CaseInsensitive)) {
3114 setElementUnderline(reader.readElementText() == u"true"_s);
3117 if (!tag.compare(u"strikeout"_s, Qt::CaseInsensitive)) {
3118 setElementStrikeOut(reader.readElementText() == u"true"_s);
3121 if (!tag.compare(u"antialiasing"_s, Qt::CaseInsensitive)) {
3122 setElementAntialiasing(reader.readElementText() == u"true"_s);
3125 if (!tag.compare(u"stylestrategy"_s, Qt::CaseInsensitive)) {
3126 setElementStyleStrategy(reader.readElementText());
3129 if (!tag.compare(u"kerning"_s, Qt::CaseInsensitive)) {
3130 setElementKerning(reader.readElementText() == u"true"_s);
3133 if (!tag.compare(u"hintingpreference"_s, Qt::CaseInsensitive)) {
3134 setElementHintingPreference(reader.readElementText());
3137 if (!tag.compare(u"fontweight"_s, Qt::CaseInsensitive)) {
3138 setElementFontWeight(reader.readElementText());
3141 reader.raiseError(
"Unexpected element "_L1 + tag);
3144 case QXmlStreamReader::EndElement :
3152void DomFont::write(QXmlStreamWriter &writer,
const QString &tagName)
const
3154 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"font") : tagName.toLower());
3156 if (m_children & Family)
3157 writer.writeTextElement(u"family"_s, m_family);
3159 if (m_children & PointSize)
3160 writer.writeTextElement(u"pointsize"_s, QString::number(m_pointSize));
3162 if (m_children & Weight)
3163 writer.writeTextElement(u"weight"_s, QString::number(m_weight));
3165 if (m_children & Italic)
3166 writer.writeTextElement(u"italic"_s, (m_italic ? u"true"_s : u"false"_s));
3168 if (m_children & Bold)
3169 writer.writeTextElement(u"bold"_s, (m_bold ? u"true"_s : u"false"_s));
3171 if (m_children & Underline)
3172 writer.writeTextElement(u"underline"_s, (m_underline ? u"true"_s : u"false"_s));
3174 if (m_children & StrikeOut)
3175 writer.writeTextElement(u"strikeout"_s, (m_strikeOut ? u"true"_s : u"false"_s));
3177 if (m_children & Antialiasing)
3178 writer.writeTextElement(u"antialiasing"_s, (m_antialiasing ? u"true"_s : u"false"_s));
3180 if (m_children & StyleStrategy)
3181 writer.writeTextElement(u"stylestrategy"_s, m_styleStrategy);
3183 if (m_children & Kerning)
3184 writer.writeTextElement(u"kerning"_s, (m_kerning ? u"true"_s : u"false"_s));
3186 if (m_children & HintingPreference)
3187 writer.writeTextElement(u"hintingpreference"_s, m_hintingPreference);
3189 if (m_children & FontWeight)
3190 writer.writeTextElement(u"fontweight"_s, m_fontWeight);
3192 writer.writeEndElement();
3195void DomFont::setElementFamily(
const QString &a)
3197 m_children |= Family;
3201void DomFont::setElementPointSize(
int a)
3203 m_children |= PointSize;
3207void DomFont::setElementWeight(
int a)
3209 m_children |= Weight;
3213void DomFont::setElementItalic(
bool a)
3215 m_children |= Italic;
3219void DomFont::setElementBold(
bool a)
3225void DomFont::setElementUnderline(
bool a)
3227 m_children |= Underline;
3231void DomFont::setElementStrikeOut(
bool a)
3233 m_children |= StrikeOut;
3237void DomFont::setElementAntialiasing(
bool a)
3239 m_children |= Antialiasing;
3243void DomFont::setElementStyleStrategy(
const QString &a)
3245 m_children |= StyleStrategy;
3246 m_styleStrategy = a;
3249void DomFont::setElementKerning(
bool a)
3251 m_children |= Kerning;
3255void DomFont::setElementHintingPreference(
const QString &a)
3257 m_children |= HintingPreference;
3258 m_hintingPreference = a;
3261void DomFont::setElementFontWeight(
const QString &a)
3263 m_children |= FontWeight;
3267void DomFont::clearElementFamily()
3269 m_children &= ~Family;
3272void DomFont::clearElementPointSize()
3274 m_children &= ~PointSize;
3277void DomFont::clearElementWeight()
3279 m_children &= ~Weight;
3282void DomFont::clearElementItalic()
3284 m_children &= ~Italic;
3287void DomFont::clearElementBold()
3289 m_children &= ~Bold;
3292void DomFont::clearElementUnderline()
3294 m_children &= ~Underline;
3297void DomFont::clearElementStrikeOut()
3299 m_children &= ~StrikeOut;
3302void DomFont::clearElementAntialiasing()
3304 m_children &= ~Antialiasing;
3307void DomFont::clearElementStyleStrategy()
3309 m_children &= ~StyleStrategy;
3312void DomFont::clearElementKerning()
3314 m_children &= ~Kerning;
3317void DomFont::clearElementHintingPreference()
3319 m_children &= ~HintingPreference;
3322void DomFont::clearElementFontWeight()
3324 m_children &= ~FontWeight;
3327DomPoint::~DomPoint() =
default;
3329void DomPoint::read(QXmlStreamReader &reader)
3331 while (!reader.hasError()) {
3332 switch (reader.readNext()) {
3333 case QXmlStreamReader::StartElement : {
3334 const auto tag = reader.name();
3335 if (!tag.compare(u"x"_s, Qt::CaseInsensitive)) {
3336 setElementX(reader.readElementText().toInt());
3339 if (!tag.compare(u"y"_s, Qt::CaseInsensitive)) {
3340 setElementY(reader.readElementText().toInt());
3343 reader.raiseError(
"Unexpected element "_L1 + tag);
3346 case QXmlStreamReader::EndElement :
3354void DomPoint::write(QXmlStreamWriter &writer,
const QString &tagName)
const
3356 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"point") : tagName.toLower());
3359 writer.writeTextElement(u"x"_s, QString::number(m_x));
3362 writer.writeTextElement(u"y"_s, QString::number(m_y));
3364 writer.writeEndElement();
3367void DomPoint::setElementX(
int a)
3373void DomPoint::setElementY(
int a)
3379void DomPoint::clearElementX()
3384void DomPoint::clearElementY()
3389DomRect::~DomRect() =
default;
3391void DomRect::read(QXmlStreamReader &reader)
3393 while (!reader.hasError()) {
3394 switch (reader.readNext()) {
3395 case QXmlStreamReader::StartElement : {
3396 const auto tag = reader.name();
3397 if (!tag.compare(u"x"_s, Qt::CaseInsensitive)) {
3398 setElementX(reader.readElementText().toInt());
3401 if (!tag.compare(u"y"_s, Qt::CaseInsensitive)) {
3402 setElementY(reader.readElementText().toInt());
3405 if (!tag.compare(u"width"_s, Qt::CaseInsensitive)) {
3406 setElementWidth(reader.readElementText().toInt());
3409 if (!tag.compare(u"height"_s, Qt::CaseInsensitive)) {
3410 setElementHeight(reader.readElementText().toInt());
3413 reader.raiseError(
"Unexpected element "_L1 + tag);
3416 case QXmlStreamReader::EndElement :
3424void DomRect::write(QXmlStreamWriter &writer,
const QString &tagName)
const
3426 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"rect") : tagName.toLower());
3429 writer.writeTextElement(u"x"_s, QString::number(m_x));
3432 writer.writeTextElement(u"y"_s, QString::number(m_y));
3434 if (m_children & Width)
3435 writer.writeTextElement(u"width"_s, QString::number(m_width));
3437 if (m_children & Height)
3438 writer.writeTextElement(u"height"_s, QString::number(m_height));
3440 writer.writeEndElement();
3443void DomRect::setElementX(
int a)
3449void DomRect::setElementY(
int a)
3455void DomRect::setElementWidth(
int a)
3457 m_children |= Width;
3461void DomRect::setElementHeight(
int a)
3463 m_children |= Height;
3467void DomRect::clearElementX()
3472void DomRect::clearElementY()
3477void DomRect::clearElementWidth()
3479 m_children &= ~Width;
3482void DomRect::clearElementHeight()
3484 m_children &= ~Height;
3487DomLocale::~DomLocale() =
default;
3489void DomLocale::read(QXmlStreamReader &reader)
3491 const QXmlStreamAttributes &attributes = reader.attributes();
3492 for (
const QXmlStreamAttribute &attribute : attributes) {
3493 const auto name = attribute.name();
3494 if (name == u"language"_s) {
3495 setAttributeLanguage(attribute.value().toString());
3498 if (name == u"country"_s) {
3499 setAttributeCountry(attribute.value().toString());
3502 reader.raiseError(
"Unexpected attribute "_L1 + name);
3505 while (!reader.hasError()) {
3506 switch (reader.readNext()) {
3507 case QXmlStreamReader::StartElement : {
3508 const auto tag = reader.name();
3509 reader.raiseError(
"Unexpected element "_L1 + tag);
3512 case QXmlStreamReader::EndElement :
3520void DomLocale::write(QXmlStreamWriter &writer,
const QString &tagName)
const
3522 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"locale") : tagName.toLower());
3524 if (hasAttributeLanguage())
3525 writer.writeAttribute(u"language"_s, attributeLanguage());
3527 if (hasAttributeCountry())
3528 writer.writeAttribute(u"country"_s, attributeCountry());
3530 writer.writeEndElement();
3533DomSizePolicy::~DomSizePolicy() =
default;
3535void DomSizePolicy::read(QXmlStreamReader &reader)
3537 const QXmlStreamAttributes &attributes = reader.attributes();
3538 for (
const QXmlStreamAttribute &attribute : attributes) {
3539 const auto name = attribute.name();
3540 if (name == u"hsizetype"_s) {
3541 setAttributeHSizeType(attribute.value().toString());
3544 if (name == u"vsizetype"_s) {
3545 setAttributeVSizeType(attribute.value().toString());
3548 reader.raiseError(
"Unexpected attribute "_L1 + name);
3551 while (!reader.hasError()) {
3552 switch (reader.readNext()) {
3553 case QXmlStreamReader::StartElement : {
3554 const auto tag = reader.name();
3555 if (!tag.compare(u"hsizetype"_s, Qt::CaseInsensitive)) {
3556 setElementHSizeType(reader.readElementText().toInt());
3559 if (!tag.compare(u"vsizetype"_s, Qt::CaseInsensitive)) {
3560 setElementVSizeType(reader.readElementText().toInt());
3563 if (!tag.compare(u"horstretch"_s, Qt::CaseInsensitive)) {
3564 setElementHorStretch(reader.readElementText().toInt());
3567 if (!tag.compare(u"verstretch"_s, Qt::CaseInsensitive)) {
3568 setElementVerStretch(reader.readElementText().toInt());
3571 reader.raiseError(
"Unexpected element "_L1 + tag);
3574 case QXmlStreamReader::EndElement :
3582void DomSizePolicy::write(QXmlStreamWriter &writer,
const QString &tagName)
const
3584 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"sizepolicy") : tagName.toLower());
3586 if (hasAttributeHSizeType())
3587 writer.writeAttribute(u"hsizetype"_s, attributeHSizeType());
3589 if (hasAttributeVSizeType())
3590 writer.writeAttribute(u"vsizetype"_s, attributeVSizeType());
3592 if (m_children & HSizeType)
3593 writer.writeTextElement(u"hsizetype"_s, QString::number(m_hSizeType));
3595 if (m_children & VSizeType)
3596 writer.writeTextElement(u"vsizetype"_s, QString::number(m_vSizeType));
3598 if (m_children & HorStretch)
3599 writer.writeTextElement(u"horstretch"_s, QString::number(m_horStretch));
3601 if (m_children & VerStretch)
3602 writer.writeTextElement(u"verstretch"_s, QString::number(m_verStretch));
3604 writer.writeEndElement();
3607void DomSizePolicy::setElementHSizeType(
int a)
3609 m_children |= HSizeType;
3613void DomSizePolicy::setElementVSizeType(
int a)
3615 m_children |= VSizeType;
3619void DomSizePolicy::setElementHorStretch(
int a)
3621 m_children |= HorStretch;
3625void DomSizePolicy::setElementVerStretch(
int a)
3627 m_children |= VerStretch;
3631void DomSizePolicy::clearElementHSizeType()
3633 m_children &= ~HSizeType;
3636void DomSizePolicy::clearElementVSizeType()
3638 m_children &= ~VSizeType;
3641void DomSizePolicy::clearElementHorStretch()
3643 m_children &= ~HorStretch;
3646void DomSizePolicy::clearElementVerStretch()
3648 m_children &= ~VerStretch;
3651DomSize::~DomSize() =
default;
3653void DomSize::read(QXmlStreamReader &reader)
3655 while (!reader.hasError()) {
3656 switch (reader.readNext()) {
3657 case QXmlStreamReader::StartElement : {
3658 const auto tag = reader.name();
3659 if (!tag.compare(u"width"_s, Qt::CaseInsensitive)) {
3660 setElementWidth(reader.readElementText().toInt());
3663 if (!tag.compare(u"height"_s, Qt::CaseInsensitive)) {
3664 setElementHeight(reader.readElementText().toInt());
3667 reader.raiseError(
"Unexpected element "_L1 + tag);
3670 case QXmlStreamReader::EndElement :
3678void DomSize::write(QXmlStreamWriter &writer,
const QString &tagName)
const
3680 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"size") : tagName.toLower());
3682 if (m_children & Width)
3683 writer.writeTextElement(u"width"_s, QString::number(m_width));
3685 if (m_children & Height)
3686 writer.writeTextElement(u"height"_s, QString::number(m_height));
3688 writer.writeEndElement();
3691void DomSize::setElementWidth(
int a)
3693 m_children |= Width;
3697void DomSize::setElementHeight(
int a)
3699 m_children |= Height;
3703void DomSize::clearElementWidth()
3705 m_children &= ~Width;
3708void DomSize::clearElementHeight()
3710 m_children &= ~Height;
3713DomDate::~DomDate() =
default;
3715void DomDate::read(QXmlStreamReader &reader)
3717 while (!reader.hasError()) {
3718 switch (reader.readNext()) {
3719 case QXmlStreamReader::StartElement : {
3720 const auto tag = reader.name();
3721 if (!tag.compare(u"year"_s, Qt::CaseInsensitive)) {
3722 setElementYear(reader.readElementText().toInt());
3725 if (!tag.compare(u"month"_s, Qt::CaseInsensitive)) {
3726 setElementMonth(reader.readElementText().toInt());
3729 if (!tag.compare(u"day"_s, Qt::CaseInsensitive)) {
3730 setElementDay(reader.readElementText().toInt());
3733 reader.raiseError(
"Unexpected element "_L1 + tag);
3736 case QXmlStreamReader::EndElement :
3744void DomDate::write(QXmlStreamWriter &writer,
const QString &tagName)
const
3746 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"date") : tagName.toLower());
3748 if (m_children & Year)
3749 writer.writeTextElement(u"year"_s, QString::number(m_year));
3751 if (m_children & Month)
3752 writer.writeTextElement(u"month"_s, QString::number(m_month));
3754 if (m_children & Day)
3755 writer.writeTextElement(u"day"_s, QString::number(m_day));
3757 writer.writeEndElement();
3760void DomDate::setElementYear(
int a)
3766void DomDate::setElementMonth(
int a)
3768 m_children |= Month;
3772void DomDate::setElementDay(
int a)
3778void DomDate::clearElementYear()
3780 m_children &= ~Year;
3783void DomDate::clearElementMonth()
3785 m_children &= ~Month;
3788void DomDate::clearElementDay()
3793DomTime::~DomTime() =
default;
3795void DomTime::read(QXmlStreamReader &reader)
3797 while (!reader.hasError()) {
3798 switch (reader.readNext()) {
3799 case QXmlStreamReader::StartElement : {
3800 const auto tag = reader.name();
3801 if (!tag.compare(u"hour"_s, Qt::CaseInsensitive)) {
3802 setElementHour(reader.readElementText().toInt());
3805 if (!tag.compare(u"minute"_s, Qt::CaseInsensitive)) {
3806 setElementMinute(reader.readElementText().toInt());
3809 if (!tag.compare(u"second"_s, Qt::CaseInsensitive)) {
3810 setElementSecond(reader.readElementText().toInt());
3813 reader.raiseError(
"Unexpected element "_L1 + tag);
3816 case QXmlStreamReader::EndElement :
3824void DomTime::write(QXmlStreamWriter &writer,
const QString &tagName)
const
3826 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"time") : tagName.toLower());
3828 if (m_children & Hour)
3829 writer.writeTextElement(u"hour"_s, QString::number(m_hour));
3831 if (m_children & Minute)
3832 writer.writeTextElement(u"minute"_s, QString::number(m_minute));
3834 if (m_children & Second)
3835 writer.writeTextElement(u"second"_s, QString::number(m_second));
3837 writer.writeEndElement();
3840void DomTime::setElementHour(
int a)
3846void DomTime::setElementMinute(
int a)
3848 m_children |= Minute;
3852void DomTime::setElementSecond(
int a)
3854 m_children |= Second;
3858void DomTime::clearElementHour()
3860 m_children &= ~Hour;
3863void DomTime::clearElementMinute()
3865 m_children &= ~Minute;
3868void DomTime::clearElementSecond()
3870 m_children &= ~Second;
3873DomDateTime::~DomDateTime() =
default;
3875void DomDateTime::read(QXmlStreamReader &reader)
3877 while (!reader.hasError()) {
3878 switch (reader.readNext()) {
3879 case QXmlStreamReader::StartElement : {
3880 const auto tag = reader.name();
3881 if (!tag.compare(u"hour"_s, Qt::CaseInsensitive)) {
3882 setElementHour(reader.readElementText().toInt());
3885 if (!tag.compare(u"minute"_s, Qt::CaseInsensitive)) {
3886 setElementMinute(reader.readElementText().toInt());
3889 if (!tag.compare(u"second"_s, Qt::CaseInsensitive)) {
3890 setElementSecond(reader.readElementText().toInt());
3893 if (!tag.compare(u"year"_s, Qt::CaseInsensitive)) {
3894 setElementYear(reader.readElementText().toInt());
3897 if (!tag.compare(u"month"_s, Qt::CaseInsensitive)) {
3898 setElementMonth(reader.readElementText().toInt());
3901 if (!tag.compare(u"day"_s, Qt::CaseInsensitive)) {
3902 setElementDay(reader.readElementText().toInt());
3905 reader.raiseError(
"Unexpected element "_L1 + tag);
3908 case QXmlStreamReader::EndElement :
3916void DomDateTime::write(QXmlStreamWriter &writer,
const QString &tagName)
const
3918 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"datetime") : tagName.toLower());
3920 if (m_children & Hour)
3921 writer.writeTextElement(u"hour"_s, QString::number(m_hour));
3923 if (m_children & Minute)
3924 writer.writeTextElement(u"minute"_s, QString::number(m_minute));
3926 if (m_children & Second)
3927 writer.writeTextElement(u"second"_s, QString::number(m_second));
3929 if (m_children & Year)
3930 writer.writeTextElement(u"year"_s, QString::number(m_year));
3932 if (m_children & Month)
3933 writer.writeTextElement(u"month"_s, QString::number(m_month));
3935 if (m_children & Day)
3936 writer.writeTextElement(u"day"_s, QString::number(m_day));
3938 writer.writeEndElement();
3941void DomDateTime::setElementHour(
int a)
3947void DomDateTime::setElementMinute(
int a)
3949 m_children |= Minute;
3953void DomDateTime::setElementSecond(
int a)
3955 m_children |= Second;
3959void DomDateTime::setElementYear(
int a)
3965void DomDateTime::setElementMonth(
int a)
3967 m_children |= Month;
3971void DomDateTime::setElementDay(
int a)
3977void DomDateTime::clearElementHour()
3979 m_children &= ~Hour;
3982void DomDateTime::clearElementMinute()
3984 m_children &= ~Minute;
3987void DomDateTime::clearElementSecond()
3989 m_children &= ~Second;
3992void DomDateTime::clearElementYear()
3994 m_children &= ~Year;
3997void DomDateTime::clearElementMonth()
3999 m_children &= ~Month;
4002void DomDateTime::clearElementDay()
4007DomStringList::~DomStringList()
4012void DomStringList::read(QXmlStreamReader &reader)
4014 const QXmlStreamAttributes &attributes = reader.attributes();
4015 for (
const QXmlStreamAttribute &attribute : attributes) {
4016 const auto name = attribute.name();
4017 if (name == u"notr"_s) {
4018 setAttributeNotr(attribute.value().toString());
4021 if (name == u"comment"_s) {
4022 setAttributeComment(attribute.value().toString());
4025 if (name == u"extracomment"_s) {
4026 setAttributeExtraComment(attribute.value().toString());
4029 if (name == u"id"_s) {
4030 setAttributeId(attribute.value().toString());
4033 reader.raiseError(
"Unexpected attribute "_L1 + name);
4036 while (!reader.hasError()) {
4037 switch (reader.readNext()) {
4038 case QXmlStreamReader::StartElement : {
4039 const auto tag = reader.name();
4040 if (!tag.compare(u"string"_s, Qt::CaseInsensitive)) {
4041 m_string.append(reader.readElementText());
4044 reader.raiseError(
"Unexpected element "_L1 + tag);
4047 case QXmlStreamReader::EndElement :
4055void DomStringList::write(QXmlStreamWriter &writer,
const QString &tagName)
const
4057 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"stringlist") : tagName.toLower());
4059 if (hasAttributeNotr())
4060 writer.writeAttribute(u"notr"_s, attributeNotr());
4062 if (hasAttributeComment())
4063 writer.writeAttribute(u"comment"_s, attributeComment());
4065 if (hasAttributeExtraComment())
4066 writer.writeAttribute(u"extracomment"_s, attributeExtraComment());
4068 if (hasAttributeId())
4069 writer.writeAttribute(u"id"_s, attributeId());
4071 for (
const QString &v : m_string)
4072 writer.writeTextElement(u"string"_s, v);
4074 writer.writeEndElement();
4077void DomStringList::setElementString(
const QStringList &a)
4079 m_children |= String;
4083DomResourcePixmap::~DomResourcePixmap() =
default;
4085void DomResourcePixmap::read(QXmlStreamReader &reader)
4087 const QXmlStreamAttributes &attributes = reader.attributes();
4088 for (
const QXmlStreamAttribute &attribute : attributes) {
4089 const auto name = attribute.name();
4090 if (name == u"resource"_s) {
4091 setAttributeResource(attribute.value().toString());
4094 if (name == u"alias"_s) {
4095 setAttributeAlias(attribute.value().toString());
4098 reader.raiseError(
"Unexpected attribute "_L1 + name);
4101 while (!reader.hasError()) {
4102 switch (reader.readNext()) {
4103 case QXmlStreamReader::StartElement : {
4104 const auto tag = reader.name();
4105 reader.raiseError(
"Unexpected element "_L1 + tag);
4108 case QXmlStreamReader::EndElement :
4110 case QXmlStreamReader::Characters :
4111 if (!reader.isWhitespace())
4112 m_text.append(reader.text().toString());
4120void DomResourcePixmap::write(QXmlStreamWriter &writer,
const QString &tagName)
const
4122 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"resourcepixmap") : tagName.toLower());
4124 if (hasAttributeResource())
4125 writer.writeAttribute(u"resource"_s, attributeResource());
4127 if (hasAttributeAlias())
4128 writer.writeAttribute(u"alias"_s, attributeAlias());
4130 if (!m_text.isEmpty())
4131 writer.writeCharacters(m_text);
4133 writer.writeEndElement();
4136DomResourceIcon::~DomResourceIcon()
4140 delete m_disabledOff;
4141 delete m_disabledOn;
4144 delete m_selectedOff;
4145 delete m_selectedOn;
4148void DomResourceIcon::read(QXmlStreamReader &reader)
4150 const QXmlStreamAttributes &attributes = reader.attributes();
4151 for (
const QXmlStreamAttribute &attribute : attributes) {
4152 const auto name = attribute.name();
4153 if (name == u"theme"_s) {
4154 setAttributeTheme(attribute.value().toString());
4157 if (name == u"resource"_s) {
4158 setAttributeResource(attribute.value().toString());
4161 reader.raiseError(
"Unexpected attribute "_L1 + name);
4164 while (!reader.hasError()) {
4165 switch (reader.readNext()) {
4166 case QXmlStreamReader::StartElement : {
4167 const auto tag = reader.name();
4168 if (!tag.compare(u"normaloff"_s, Qt::CaseInsensitive)) {
4169 auto *v =
new DomResourcePixmap();
4171 setElementNormalOff(v);
4174 if (!tag.compare(u"normalon"_s, Qt::CaseInsensitive)) {
4175 auto *v =
new DomResourcePixmap();
4177 setElementNormalOn(v);
4180 if (!tag.compare(u"disabledoff"_s, Qt::CaseInsensitive)) {
4181 auto *v =
new DomResourcePixmap();
4183 setElementDisabledOff(v);
4186 if (!tag.compare(u"disabledon"_s, Qt::CaseInsensitive)) {
4187 auto *v =
new DomResourcePixmap();
4189 setElementDisabledOn(v);
4192 if (!tag.compare(u"activeoff"_s, Qt::CaseInsensitive)) {
4193 auto *v =
new DomResourcePixmap();
4195 setElementActiveOff(v);
4198 if (!tag.compare(u"activeon"_s, Qt::CaseInsensitive)) {
4199 auto *v =
new DomResourcePixmap();
4201 setElementActiveOn(v);
4204 if (!tag.compare(u"selectedoff"_s, Qt::CaseInsensitive)) {
4205 auto *v =
new DomResourcePixmap();
4207 setElementSelectedOff(v);
4210 if (!tag.compare(u"selectedon"_s, Qt::CaseInsensitive)) {
4211 auto *v =
new DomResourcePixmap();
4213 setElementSelectedOn(v);
4216 reader.raiseError(
"Unexpected element "_L1 + tag);
4219 case QXmlStreamReader::EndElement :
4221 case QXmlStreamReader::Characters :
4222 if (!reader.isWhitespace())
4223 m_text.append(reader.text().toString());
4231void DomResourceIcon::write(QXmlStreamWriter &writer,
const QString &tagName)
const
4233 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"resourceicon") : tagName.toLower());
4235 if (hasAttributeTheme())
4236 writer.writeAttribute(u"theme"_s, attributeTheme());
4238 if (hasAttributeResource())
4239 writer.writeAttribute(u"resource"_s, attributeResource());
4241 if (m_children & NormalOff)
4242 m_normalOff->write(writer, u"normaloff"_s);
4244 if (m_children & NormalOn)
4245 m_normalOn->write(writer, u"normalon"_s);
4247 if (m_children & DisabledOff)
4248 m_disabledOff->write(writer, u"disabledoff"_s);
4250 if (m_children & DisabledOn)
4251 m_disabledOn->write(writer, u"disabledon"_s);
4253 if (m_children & ActiveOff)
4254 m_activeOff->write(writer, u"activeoff"_s);
4256 if (m_children & ActiveOn)
4257 m_activeOn->write(writer, u"activeon"_s);
4259 if (m_children & SelectedOff)
4260 m_selectedOff->write(writer, u"selectedoff"_s);
4262 if (m_children & SelectedOn)
4263 m_selectedOn->write(writer, u"selectedon"_s);
4265 if (!m_text.isEmpty())
4266 writer.writeCharacters(m_text);
4268 writer.writeEndElement();
4271DomResourcePixmap *DomResourceIcon::takeElementNormalOff()
4273 DomResourcePixmap *a = m_normalOff;
4274 m_normalOff =
nullptr;
4275 m_children ^= NormalOff;
4279void DomResourceIcon::setElementNormalOff(DomResourcePixmap *a)
4282 m_children |= NormalOff;
4286DomResourcePixmap *DomResourceIcon::takeElementNormalOn()
4288 DomResourcePixmap *a = m_normalOn;
4289 m_normalOn =
nullptr;
4290 m_children ^= NormalOn;
4294void DomResourceIcon::setElementNormalOn(DomResourcePixmap *a)
4297 m_children |= NormalOn;
4301DomResourcePixmap *DomResourceIcon::takeElementDisabledOff()
4303 DomResourcePixmap *a = m_disabledOff;
4304 m_disabledOff =
nullptr;
4305 m_children ^= DisabledOff;
4309void DomResourceIcon::setElementDisabledOff(DomResourcePixmap *a)
4311 delete m_disabledOff;
4312 m_children |= DisabledOff;
4316DomResourcePixmap *DomResourceIcon::takeElementDisabledOn()
4318 DomResourcePixmap *a = m_disabledOn;
4319 m_disabledOn =
nullptr;
4320 m_children ^= DisabledOn;
4324void DomResourceIcon::setElementDisabledOn(DomResourcePixmap *a)
4326 delete m_disabledOn;
4327 m_children |= DisabledOn;
4331DomResourcePixmap *DomResourceIcon::takeElementActiveOff()
4333 DomResourcePixmap *a = m_activeOff;
4334 m_activeOff =
nullptr;
4335 m_children ^= ActiveOff;
4339void DomResourceIcon::setElementActiveOff(DomResourcePixmap *a)
4342 m_children |= ActiveOff;
4346DomResourcePixmap *DomResourceIcon::takeElementActiveOn()
4348 DomResourcePixmap *a = m_activeOn;
4349 m_activeOn =
nullptr;
4350 m_children ^= ActiveOn;
4354void DomResourceIcon::setElementActiveOn(DomResourcePixmap *a)
4357 m_children |= ActiveOn;
4361DomResourcePixmap *DomResourceIcon::takeElementSelectedOff()
4363 DomResourcePixmap *a = m_selectedOff;
4364 m_selectedOff =
nullptr;
4365 m_children ^= SelectedOff;
4369void DomResourceIcon::setElementSelectedOff(DomResourcePixmap *a)
4371 delete m_selectedOff;
4372 m_children |= SelectedOff;
4376DomResourcePixmap *DomResourceIcon::takeElementSelectedOn()
4378 DomResourcePixmap *a = m_selectedOn;
4379 m_selectedOn =
nullptr;
4380 m_children ^= SelectedOn;
4384void DomResourceIcon::setElementSelectedOn(DomResourcePixmap *a)
4386 delete m_selectedOn;
4387 m_children |= SelectedOn;
4391void DomResourceIcon::clearElementNormalOff()
4394 m_normalOff =
nullptr;
4395 m_children &= ~NormalOff;
4398void DomResourceIcon::clearElementNormalOn()
4401 m_normalOn =
nullptr;
4402 m_children &= ~NormalOn;
4405void DomResourceIcon::clearElementDisabledOff()
4407 delete m_disabledOff;
4408 m_disabledOff =
nullptr;
4409 m_children &= ~DisabledOff;
4412void DomResourceIcon::clearElementDisabledOn()
4414 delete m_disabledOn;
4415 m_disabledOn =
nullptr;
4416 m_children &= ~DisabledOn;
4419void DomResourceIcon::clearElementActiveOff()
4422 m_activeOff =
nullptr;
4423 m_children &= ~ActiveOff;
4426void DomResourceIcon::clearElementActiveOn()
4429 m_activeOn =
nullptr;
4430 m_children &= ~ActiveOn;
4433void DomResourceIcon::clearElementSelectedOff()
4435 delete m_selectedOff;
4436 m_selectedOff =
nullptr;
4437 m_children &= ~SelectedOff;
4440void DomResourceIcon::clearElementSelectedOn()
4442 delete m_selectedOn;
4443 m_selectedOn =
nullptr;
4444 m_children &= ~SelectedOn;
4447DomString::~DomString() =
default;
4449void DomString::read(QXmlStreamReader &reader)
4451 const QXmlStreamAttributes &attributes = reader.attributes();
4452 for (
const QXmlStreamAttribute &attribute : attributes) {
4453 const auto name = attribute.name();
4454 if (name == u"notr"_s) {
4455 setAttributeNotr(attribute.value().toString());
4458 if (name == u"comment"_s) {
4459 setAttributeComment(attribute.value().toString());
4462 if (name == u"extracomment"_s) {
4463 setAttributeExtraComment(attribute.value().toString());
4466 if (name == u"id"_s) {
4467 setAttributeId(attribute.value().toString());
4470 reader.raiseError(
"Unexpected attribute "_L1 + name);
4473 while (!reader.hasError()) {
4474 switch (reader.readNext()) {
4475 case QXmlStreamReader::StartElement : {
4476 const auto tag = reader.name();
4477 reader.raiseError(
"Unexpected element "_L1 + tag);
4480 case QXmlStreamReader::EndElement :
4482 case QXmlStreamReader::Characters :
4483 if (!reader.isWhitespace())
4484 m_text.append(reader.text().toString());
4492void DomString::write(QXmlStreamWriter &writer,
const QString &tagName)
const
4494 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"string") : tagName.toLower());
4496 if (hasAttributeNotr())
4497 writer.writeAttribute(u"notr"_s, attributeNotr());
4499 if (hasAttributeComment())
4500 writer.writeAttribute(u"comment"_s, attributeComment());
4502 if (hasAttributeExtraComment())
4503 writer.writeAttribute(u"extracomment"_s, attributeExtraComment());
4505 if (hasAttributeId())
4506 writer.writeAttribute(u"id"_s, attributeId());
4508 if (!m_text.isEmpty())
4509 writer.writeCharacters(m_text);
4511 writer.writeEndElement();
4514DomPointF::~DomPointF() =
default;
4516void DomPointF::read(QXmlStreamReader &reader)
4518 while (!reader.hasError()) {
4519 switch (reader.readNext()) {
4520 case QXmlStreamReader::StartElement : {
4521 const auto tag = reader.name();
4522 if (!tag.compare(u"x"_s, Qt::CaseInsensitive)) {
4523 setElementX(reader.readElementText().toDouble());
4526 if (!tag.compare(u"y"_s, Qt::CaseInsensitive)) {
4527 setElementY(reader.readElementText().toDouble());
4530 reader.raiseError(
"Unexpected element "_L1 + tag);
4533 case QXmlStreamReader::EndElement :
4541void DomPointF::write(QXmlStreamWriter &writer,
const QString &tagName)
const
4543 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"pointf") : tagName.toLower());
4546 writer.writeTextElement(u"x"_s, QString::number(m_x,
'f', 15));
4549 writer.writeTextElement(u"y"_s, QString::number(m_y,
'f', 15));
4551 writer.writeEndElement();
4554void DomPointF::setElementX(
double a)
4560void DomPointF::setElementY(
double a)
4566void DomPointF::clearElementX()
4571void DomPointF::clearElementY()
4576DomRectF::~DomRectF() =
default;
4578void DomRectF::read(QXmlStreamReader &reader)
4580 while (!reader.hasError()) {
4581 switch (reader.readNext()) {
4582 case QXmlStreamReader::StartElement : {
4583 const auto tag = reader.name();
4584 if (!tag.compare(u"x"_s, Qt::CaseInsensitive)) {
4585 setElementX(reader.readElementText().toDouble());
4588 if (!tag.compare(u"y"_s, Qt::CaseInsensitive)) {
4589 setElementY(reader.readElementText().toDouble());
4592 if (!tag.compare(u"width"_s, Qt::CaseInsensitive)) {
4593 setElementWidth(reader.readElementText().toDouble());
4596 if (!tag.compare(u"height"_s, Qt::CaseInsensitive)) {
4597 setElementHeight(reader.readElementText().toDouble());
4600 reader.raiseError(
"Unexpected element "_L1 + tag);
4603 case QXmlStreamReader::EndElement :
4611void DomRectF::write(QXmlStreamWriter &writer,
const QString &tagName)
const
4613 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"rectf") : tagName.toLower());
4616 writer.writeTextElement(u"x"_s, QString::number(m_x,
'f', 15));
4619 writer.writeTextElement(u"y"_s, QString::number(m_y,
'f', 15));
4621 if (m_children & Width)
4622 writer.writeTextElement(u"width"_s, QString::number(m_width,
'f', 15));
4624 if (m_children & Height)
4625 writer.writeTextElement(u"height"_s, QString::number(m_height,
'f', 15));
4627 writer.writeEndElement();
4630void DomRectF::setElementX(
double a)
4636void DomRectF::setElementY(
double a)
4642void DomRectF::setElementWidth(
double a)
4644 m_children |= Width;
4648void DomRectF::setElementHeight(
double a)
4650 m_children |= Height;
4654void DomRectF::clearElementX()
4659void DomRectF::clearElementY()
4664void DomRectF::clearElementWidth()
4666 m_children &= ~Width;
4669void DomRectF::clearElementHeight()
4671 m_children &= ~Height;
4674DomSizeF::~DomSizeF() =
default;
4676void DomSizeF::read(QXmlStreamReader &reader)
4678 while (!reader.hasError()) {
4679 switch (reader.readNext()) {
4680 case QXmlStreamReader::StartElement : {
4681 const auto tag = reader.name();
4682 if (!tag.compare(u"width"_s, Qt::CaseInsensitive)) {
4683 setElementWidth(reader.readElementText().toDouble());
4686 if (!tag.compare(u"height"_s, Qt::CaseInsensitive)) {
4687 setElementHeight(reader.readElementText().toDouble());
4690 reader.raiseError(
"Unexpected element "_L1 + tag);
4693 case QXmlStreamReader::EndElement :
4701void DomSizeF::write(QXmlStreamWriter &writer,
const QString &tagName)
const
4703 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"sizef") : tagName.toLower());
4705 if (m_children & Width)
4706 writer.writeTextElement(u"width"_s, QString::number(m_width,
'f', 15));
4708 if (m_children & Height)
4709 writer.writeTextElement(u"height"_s, QString::number(m_height,
'f', 15));
4711 writer.writeEndElement();
4714void DomSizeF::setElementWidth(
double a)
4716 m_children |= Width;
4720void DomSizeF::setElementHeight(
double a)
4722 m_children |= Height;
4726void DomSizeF::clearElementWidth()
4728 m_children &= ~Width;
4731void DomSizeF::clearElementHeight()
4733 m_children &= ~Height;
4736DomChar::~DomChar() =
default;
4738void DomChar::read(QXmlStreamReader &reader)
4740 while (!reader.hasError()) {
4741 switch (reader.readNext()) {
4742 case QXmlStreamReader::StartElement : {
4743 const auto tag = reader.name();
4744 if (!tag.compare(u"unicode"_s, Qt::CaseInsensitive)) {
4745 setElementUnicode(reader.readElementText().toInt());
4748 reader.raiseError(
"Unexpected element "_L1 + tag);
4751 case QXmlStreamReader::EndElement :
4759void DomChar::write(QXmlStreamWriter &writer,
const QString &tagName)
const
4761 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"char") : tagName.toLower());
4763 if (m_children & Unicode)
4764 writer.writeTextElement(u"unicode"_s, QString::number(m_unicode));
4766 writer.writeEndElement();
4769void DomChar::setElementUnicode(
int a)
4771 m_children |= Unicode;
4775void DomChar::clearElementUnicode()
4777 m_children &= ~Unicode;
4785void DomUrl::read(QXmlStreamReader &reader)
4787 while (!reader.hasError()) {
4788 switch (reader.readNext()) {
4789 case QXmlStreamReader::StartElement : {
4790 const auto tag = reader.name();
4791 if (!tag.compare(u"string"_s, Qt::CaseInsensitive)) {
4792 auto *v =
new DomString();
4794 setElementString(v);
4797 reader.raiseError(
"Unexpected element "_L1 + tag);
4800 case QXmlStreamReader::EndElement :
4808void DomUrl::write(QXmlStreamWriter &writer,
const QString &tagName)
const
4810 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"url") : tagName.toLower());
4812 if (m_children & String)
4813 m_string->write(writer, u"string"_s);
4815 writer.writeEndElement();
4818DomString *DomUrl::takeElementString()
4820 DomString *a = m_string;
4822 m_children ^= String;
4826void DomUrl::setElementString(DomString *a)
4829 m_children |= String;
4833void DomUrl::clearElementString()
4837 m_children &= ~String;
4840DomProperty::~DomProperty()
4850 delete m_sizePolicy;
4853 delete m_stringList;
4865void DomProperty::clear()
4875 delete m_sizePolicy;
4878 delete m_stringList;
4894 m_iconSet =
nullptr;
4896 m_palette =
nullptr;
4900 m_sizePolicy =
nullptr;
4903 m_stringList =
nullptr;
4909 m_dateTime =
nullptr;
4921void DomProperty::read(QXmlStreamReader &reader)
4923 const QXmlStreamAttributes &attributes = reader.attributes();
4924 for (
const QXmlStreamAttribute &attribute : attributes) {
4925 const auto name = attribute.name();
4926 if (name == u"name"_s) {
4927 setAttributeName(attribute.value().toString());
4930 if (name == u"stdset"_s) {
4931 setAttributeStdset(attribute.value().toInt());
4934 reader.raiseError(
"Unexpected attribute "_L1 + name);
4937 while (!reader.hasError()) {
4938 switch (reader.readNext()) {
4939 case QXmlStreamReader::StartElement : {
4940 const auto tag = reader.name();
4941 if (!tag.compare(u"bool"_s, Qt::CaseInsensitive)) {
4942 setElementBool(reader.readElementText());
4945 if (!tag.compare(u"color"_s, Qt::CaseInsensitive)) {
4946 auto *v =
new DomColor();
4951 if (!tag.compare(u"cstring"_s, Qt::CaseInsensitive)) {
4952 setElementCstring(reader.readElementText());
4955 if (!tag.compare(u"cursor"_s, Qt::CaseInsensitive)) {
4956 setElementCursor(reader.readElementText().toInt());
4959 if (!tag.compare(u"cursorshape"_s, Qt::CaseInsensitive)) {
4960 setElementCursorShape(reader.readElementText());
4963 if (!tag.compare(u"enum"_s, Qt::CaseInsensitive)) {
4964 setElementEnum(reader.readElementText());
4967 if (!tag.compare(u"font"_s, Qt::CaseInsensitive)) {
4968 auto *v =
new DomFont();
4973 if (!tag.compare(u"iconset"_s, Qt::CaseInsensitive)) {
4974 auto *v =
new DomResourceIcon();
4976 setElementIconSet(v);
4979 if (!tag.compare(u"pixmap"_s, Qt::CaseInsensitive)) {
4980 auto *v =
new DomResourcePixmap();
4982 setElementPixmap(v);
4985 if (!tag.compare(u"palette"_s, Qt::CaseInsensitive)) {
4986 auto *v =
new DomPalette();
4988 setElementPalette(v);
4991 if (!tag.compare(u"point"_s, Qt::CaseInsensitive)) {
4992 auto *v =
new DomPoint();
4997 if (!tag.compare(u"rect"_s, Qt::CaseInsensitive)) {
4998 auto *v =
new DomRect();
5003 if (!tag.compare(u"set"_s, Qt::CaseInsensitive)) {
5004 setElementSet(reader.readElementText());
5007 if (!tag.compare(u"locale"_s, Qt::CaseInsensitive)) {
5008 auto *v =
new DomLocale();
5010 setElementLocale(v);
5013 if (!tag.compare(u"sizepolicy"_s, Qt::CaseInsensitive)) {
5014 auto *v =
new DomSizePolicy();
5016 setElementSizePolicy(v);
5019 if (!tag.compare(u"size"_s, Qt::CaseInsensitive)) {
5020 auto *v =
new DomSize();
5025 if (!tag.compare(u"string"_s, Qt::CaseInsensitive)) {
5026 auto *v =
new DomString();
5028 setElementString(v);
5031 if (!tag.compare(u"stringlist"_s, Qt::CaseInsensitive)) {
5032 auto *v =
new DomStringList();
5034 setElementStringList(v);
5037 if (!tag.compare(u"number"_s, Qt::CaseInsensitive)) {
5038 setElementNumber(reader.readElementText().toInt());
5041 if (!tag.compare(u"float"_s, Qt::CaseInsensitive)) {
5042 setElementFloat(reader.readElementText().toFloat());
5045 if (!tag.compare(u"double"_s, Qt::CaseInsensitive)) {
5046 setElementDouble(reader.readElementText().toDouble());
5049 if (!tag.compare(u"date"_s, Qt::CaseInsensitive)) {
5050 auto *v =
new DomDate();
5055 if (!tag.compare(u"time"_s, Qt::CaseInsensitive)) {
5056 auto *v =
new DomTime();
5061 if (!tag.compare(u"datetime"_s, Qt::CaseInsensitive)) {
5062 auto *v =
new DomDateTime();
5064 setElementDateTime(v);
5067 if (!tag.compare(u"pointf"_s, Qt::CaseInsensitive)) {
5068 auto *v =
new DomPointF();
5070 setElementPointF(v);
5073 if (!tag.compare(u"rectf"_s, Qt::CaseInsensitive)) {
5074 auto *v =
new DomRectF();
5079 if (!tag.compare(u"sizef"_s, Qt::CaseInsensitive)) {
5080 auto *v =
new DomSizeF();
5085 if (!tag.compare(u"longlong"_s, Qt::CaseInsensitive)) {
5086 setElementLongLong(reader.readElementText().toLongLong());
5089 if (!tag.compare(u"char"_s, Qt::CaseInsensitive)) {
5090 auto *v =
new DomChar();
5095 if (!tag.compare(u"url"_s, Qt::CaseInsensitive)) {
5096 auto *v =
new DomUrl();
5101 if (!tag.compare(u"uint"_s, Qt::CaseInsensitive)) {
5102 setElementUInt(reader.readElementText().toUInt());
5105 if (!tag.compare(u"ulonglong"_s, Qt::CaseInsensitive)) {
5106 setElementULongLong(reader.readElementText().toULongLong());
5109 if (!tag.compare(u"brush"_s, Qt::CaseInsensitive)) {
5110 auto *v =
new DomBrush();
5115 reader.raiseError(
"Unexpected element "_L1 + tag);
5118 case QXmlStreamReader::EndElement :
5126void DomProperty::write(QXmlStreamWriter &writer,
const QString &tagName)
const
5128 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"property") : tagName.toLower());
5130 if (hasAttributeName())
5131 writer.writeAttribute(u"name"_s, attributeName());
5133 if (hasAttributeStdset())
5134 writer.writeAttribute(u"stdset"_s, QString::number(attributeStdset()));
5138 writer.writeTextElement(u"bool"_s, elementBool());
5142 if (m_color !=
nullptr)
5143 m_color->write(writer, u"color"_s);
5147 writer.writeTextElement(u"cstring"_s, elementCstring());
5151 writer.writeTextElement(u"cursor"_s, QString::number(elementCursor()));
5155 writer.writeTextElement(u"cursorShape"_s, elementCursorShape());
5159 writer.writeTextElement(u"enum"_s, elementEnum());
5163 if (m_font !=
nullptr)
5164 m_font->write(writer, u"font"_s);
5168 if (m_iconSet !=
nullptr)
5169 m_iconSet->write(writer, u"iconset"_s);
5173 if (m_pixmap !=
nullptr)
5174 m_pixmap->write(writer, u"pixmap"_s);
5178 if (m_palette !=
nullptr)
5179 m_palette->write(writer, u"palette"_s);
5183 if (m_point !=
nullptr)
5184 m_point->write(writer, u"point"_s);
5188 if (m_rect !=
nullptr)
5189 m_rect->write(writer, u"rect"_s);
5193 writer.writeTextElement(u"set"_s, elementSet());
5197 if (m_locale !=
nullptr)
5198 m_locale->write(writer, u"locale"_s);
5202 if (m_sizePolicy !=
nullptr)
5203 m_sizePolicy->write(writer, u"sizepolicy"_s);
5207 if (m_size !=
nullptr)
5208 m_size->write(writer, u"size"_s);
5212 if (m_string !=
nullptr)
5213 m_string->write(writer, u"string"_s);
5217 if (m_stringList !=
nullptr)
5218 m_stringList->write(writer, u"stringlist"_s);
5222 writer.writeTextElement(u"number"_s, QString::number(elementNumber()));
5226 writer.writeTextElement(u"float"_s, QString::number(elementFloat(),
'f', 8));
5230 writer.writeTextElement(u"double"_s, QString::number(elementDouble(),
'f', 15));
5234 if (m_date !=
nullptr)
5235 m_date->write(writer, u"date"_s);
5239 if (m_time !=
nullptr)
5240 m_time->write(writer, u"time"_s);
5244 if (m_dateTime !=
nullptr)
5245 m_dateTime->write(writer, u"datetime"_s);
5249 if (m_pointF !=
nullptr)
5250 m_pointF->write(writer, u"pointf"_s);
5254 if (m_rectF !=
nullptr)
5255 m_rectF->write(writer, u"rectf"_s);
5259 if (m_sizeF !=
nullptr)
5260 m_sizeF->write(writer, u"sizef"_s);
5264 writer.writeTextElement(u"longLong"_s, QString::number(elementLongLong()));
5268 if (m_char !=
nullptr)
5269 m_char->write(writer, u"char"_s);
5273 if (m_url !=
nullptr)
5274 m_url->write(writer, u"url"_s);
5278 writer.writeTextElement(u"UInt"_s, QString::number(elementUInt()));
5282 writer.writeTextElement(u"uLongLong"_s, QString::number(elementULongLong()));
5286 if (m_brush !=
nullptr)
5287 m_brush->write(writer, u"brush"_s);
5293 writer.writeEndElement();
5296void DomProperty::setElementBool(
const QString &a)
5303DomColor *DomProperty::takeElementColor()
5305 DomColor *a = m_color;
5310void DomProperty::setElementColor(DomColor *a)
5317void DomProperty::setElementCstring(
const QString &a)
5324void DomProperty::setElementCursor(
int a)
5331void DomProperty::setElementCursorShape(
const QString &a)
5334 m_kind = CursorShape;
5338void DomProperty::setElementEnum(
const QString &a)
5345DomFont *DomProperty::takeElementFont()
5347 DomFont *a = m_font;
5352void DomProperty::setElementFont(DomFont *a)
5359DomResourceIcon *DomProperty::takeElementIconSet()
5361 DomResourceIcon *a = m_iconSet;
5362 m_iconSet =
nullptr;
5366void DomProperty::setElementIconSet(DomResourceIcon *a)
5373DomResourcePixmap *DomProperty::takeElementPixmap()
5375 DomResourcePixmap *a = m_pixmap;
5380void DomProperty::setElementPixmap(DomResourcePixmap *a)
5387DomPalette *DomProperty::takeElementPalette()
5389 DomPalette *a = m_palette;
5390 m_palette =
nullptr;
5394void DomProperty::setElementPalette(DomPalette *a)
5401DomPoint *DomProperty::takeElementPoint()
5403 DomPoint *a = m_point;
5408void DomProperty::setElementPoint(DomPoint *a)
5415DomRect *DomProperty::takeElementRect()
5417 DomRect *a = m_rect;
5422void DomProperty::setElementRect(DomRect *a)
5429void DomProperty::setElementSet(
const QString &a)
5436DomLocale *DomProperty::takeElementLocale()
5438 DomLocale *a = m_locale;
5443void DomProperty::setElementLocale(DomLocale *a)
5450DomSizePolicy *DomProperty::takeElementSizePolicy()
5452 DomSizePolicy *a = m_sizePolicy;
5453 m_sizePolicy =
nullptr;
5457void DomProperty::setElementSizePolicy(DomSizePolicy *a)
5460 m_kind = SizePolicy;
5464DomSize *DomProperty::takeElementSize()
5466 DomSize *a = m_size;
5471void DomProperty::setElementSize(DomSize *a)
5478DomString *DomProperty::takeElementString()
5480 DomString *a = m_string;
5485void DomProperty::setElementString(DomString *a)
5492DomStringList *DomProperty::takeElementStringList()
5494 DomStringList *a = m_stringList;
5495 m_stringList =
nullptr;
5499void DomProperty::setElementStringList(DomStringList *a)
5502 m_kind = StringList;
5506void DomProperty::setElementNumber(
int a)
5513void DomProperty::setElementFloat(
float a)
5520void DomProperty::setElementDouble(
double a)
5527DomDate *DomProperty::takeElementDate()
5529 DomDate *a = m_date;
5534void DomProperty::setElementDate(DomDate *a)
5541DomTime *DomProperty::takeElementTime()
5543 DomTime *a = m_time;
5548void DomProperty::setElementTime(DomTime *a)
5555DomDateTime *DomProperty::takeElementDateTime()
5557 DomDateTime *a = m_dateTime;
5558 m_dateTime =
nullptr;
5562void DomProperty::setElementDateTime(DomDateTime *a)
5569DomPointF *DomProperty::takeElementPointF()
5571 DomPointF *a = m_pointF;
5576void DomProperty::setElementPointF(DomPointF *a)
5583DomRectF *DomProperty::takeElementRectF()
5585 DomRectF *a = m_rectF;
5590void DomProperty::setElementRectF(DomRectF *a)
5597DomSizeF *DomProperty::takeElementSizeF()
5599 DomSizeF *a = m_sizeF;
5604void DomProperty::setElementSizeF(DomSizeF *a)
5611void DomProperty::setElementLongLong(qlonglong a)
5618DomChar *DomProperty::takeElementChar()
5620 DomChar *a = m_char;
5625void DomProperty::setElementChar(DomChar *a)
5632DomUrl *DomProperty::takeElementUrl()
5639void DomProperty::setElementUrl(DomUrl *a)
5646void DomProperty::setElementUInt(uint a)
5653void DomProperty::setElementULongLong(qulonglong a)
5660DomBrush *DomProperty::takeElementBrush()
5662 DomBrush *a = m_brush;
5667void DomProperty::setElementBrush(DomBrush *a)
5674DomConnections::~DomConnections()
5676 qDeleteAll(m_connection);
5677 m_connection.clear();
5680void DomConnections::read(QXmlStreamReader &reader)
5682 while (!reader.hasError()) {
5683 switch (reader.readNext()) {
5684 case QXmlStreamReader::StartElement : {
5685 const auto tag = reader.name();
5686 if (!tag.compare(u"connection"_s, Qt::CaseInsensitive)) {
5687 auto *v =
new DomConnection();
5689 m_connection.append(v);
5692 reader.raiseError(
"Unexpected element "_L1 + tag);
5695 case QXmlStreamReader::EndElement :
5703void DomConnections::write(QXmlStreamWriter &writer,
const QString &tagName)
const
5705 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"connections") : tagName.toLower());
5707 for (DomConnection *v : m_connection)
5708 v->write(writer, u"connection"_s);
5710 writer.writeEndElement();
5713void DomConnections::setElementConnection(
const QList<DomConnection *> &a)
5715 m_children |= Connection;
5719DomConnection::~DomConnection()
5724void DomConnection::read(QXmlStreamReader &reader)
5726 while (!reader.hasError()) {
5727 switch (reader.readNext()) {
5728 case QXmlStreamReader::StartElement : {
5729 const auto tag = reader.name();
5730 if (!tag.compare(u"sender"_s, Qt::CaseInsensitive)) {
5731 setElementSender(reader.readElementText());
5734 if (!tag.compare(u"signal"_s, Qt::CaseInsensitive)) {
5735 setElementSignal(reader.readElementText());
5738 if (!tag.compare(u"receiver"_s, Qt::CaseInsensitive)) {
5739 setElementReceiver(reader.readElementText());
5742 if (!tag.compare(u"slot"_s, Qt::CaseInsensitive)) {
5743 setElementSlot(reader.readElementText());
5746 if (!tag.compare(u"hints"_s, Qt::CaseInsensitive)) {
5747 auto *v =
new DomConnectionHints();
5752 reader.raiseError(
"Unexpected element "_L1 + tag);
5755 case QXmlStreamReader::EndElement :
5763void DomConnection::write(QXmlStreamWriter &writer,
const QString &tagName)
const
5765 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"connection") : tagName.toLower());
5767 if (m_children & Sender)
5768 writer.writeTextElement(u"sender"_s, m_sender);
5770 if (m_children & Signal)
5771 writer.writeTextElement(u"signal"_s, m_signal);
5773 if (m_children & Receiver)
5774 writer.writeTextElement(u"receiver"_s, m_receiver);
5776 if (m_children & Slot)
5777 writer.writeTextElement(u"slot"_s, m_slot);
5779 if (m_children & Hints)
5780 m_hints->write(writer, u"hints"_s);
5782 writer.writeEndElement();
5785void DomConnection::setElementSender(
const QString &a)
5787 m_children |= Sender;
5791void DomConnection::setElementSignal(
const QString &a)
5793 m_children |= Signal;
5797void DomConnection::setElementReceiver(
const QString &a)
5799 m_children |= Receiver;
5803void DomConnection::setElementSlot(
const QString &a)
5809DomConnectionHints *DomConnection::takeElementHints()
5811 DomConnectionHints *a = m_hints;
5813 m_children ^= Hints;
5817void DomConnection::setElementHints(DomConnectionHints *a)
5820 m_children |= Hints;
5824void DomConnection::clearElementSender()
5826 m_children &= ~Sender;
5829void DomConnection::clearElementSignal()
5831 m_children &= ~Signal;
5834void DomConnection::clearElementReceiver()
5836 m_children &= ~Receiver;
5839void DomConnection::clearElementSlot()
5841 m_children &= ~Slot;
5844void DomConnection::clearElementHints()
5848 m_children &= ~Hints;
5851DomConnectionHints::~DomConnectionHints()
5857void DomConnectionHints::read(QXmlStreamReader &reader)
5859 while (!reader.hasError()) {
5860 switch (reader.readNext()) {
5861 case QXmlStreamReader::StartElement : {
5862 const auto tag = reader.name();
5863 if (!tag.compare(u"hint"_s, Qt::CaseInsensitive)) {
5864 auto *v =
new DomConnectionHint();
5869 reader.raiseError(
"Unexpected element "_L1 + tag);
5872 case QXmlStreamReader::EndElement :
5880void DomConnectionHints::write(QXmlStreamWriter &writer,
const QString &tagName)
const
5882 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"connectionhints") : tagName.toLower());
5884 for (DomConnectionHint *v : m_hint)
5885 v->write(writer, u"hint"_s);
5887 writer.writeEndElement();
5890void DomConnectionHints::setElementHint(
const QList<DomConnectionHint *> &a)
5896DomConnectionHint::~DomConnectionHint() =
default;
5898void DomConnectionHint::read(QXmlStreamReader &reader)
5900 const QXmlStreamAttributes &attributes = reader.attributes();
5901 for (
const QXmlStreamAttribute &attribute : attributes) {
5902 const auto name = attribute.name();
5903 if (name == u"type"_s) {
5904 setAttributeType(attribute.value().toString());
5907 reader.raiseError(
"Unexpected attribute "_L1 + name);
5910 while (!reader.hasError()) {
5911 switch (reader.readNext()) {
5912 case QXmlStreamReader::StartElement : {
5913 const auto tag = reader.name();
5914 if (!tag.compare(u"x"_s, Qt::CaseInsensitive)) {
5915 setElementX(reader.readElementText().toInt());
5918 if (!tag.compare(u"y"_s, Qt::CaseInsensitive)) {
5919 setElementY(reader.readElementText().toInt());
5922 reader.raiseError(
"Unexpected element "_L1 + tag);
5925 case QXmlStreamReader::EndElement :
5933void DomConnectionHint::write(QXmlStreamWriter &writer,
const QString &tagName)
const
5935 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"connectionhint") : tagName.toLower());
5937 if (hasAttributeType())
5938 writer.writeAttribute(u"type"_s, attributeType());
5941 writer.writeTextElement(u"x"_s, QString::number(m_x));
5944 writer.writeTextElement(u"y"_s, QString::number(m_y));
5946 writer.writeEndElement();
5949void DomConnectionHint::setElementX(
int a)
5955void DomConnectionHint::setElementY(
int a)
5961void DomConnectionHint::clearElementX()
5966void DomConnectionHint::clearElementY()
5971DomDesignerData::~DomDesignerData()
5973 qDeleteAll(m_property);
5977void DomDesignerData::read(QXmlStreamReader &reader)
5979 while (!reader.hasError()) {
5980 switch (reader.readNext()) {
5981 case QXmlStreamReader::StartElement : {
5982 const auto tag = reader.name();
5983 if (!tag.compare(u"property"_s, Qt::CaseInsensitive)) {
5984 auto *v =
new DomProperty();
5986 m_property.append(v);
5989 reader.raiseError(
"Unexpected element "_L1 + tag);
5992 case QXmlStreamReader::EndElement :
6000void DomDesignerData::write(QXmlStreamWriter &writer,
const QString &tagName)
const
6002 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"designerdata") : tagName.toLower());
6004 for (DomProperty *v : m_property)
6005 v->write(writer, u"property"_s);
6007 writer.writeEndElement();
6010void DomDesignerData::setElementProperty(
const QList<DomProperty *> &a)
6012 m_children |= Property;
6016DomSlots::~DomSlots()
6022void DomSlots::read(QXmlStreamReader &reader)
6024 while (!reader.hasError()) {
6025 switch (reader.readNext()) {
6026 case QXmlStreamReader::StartElement : {
6027 const auto tag = reader.name();
6028 if (!tag.compare(u"signal"_s, Qt::CaseInsensitive)) {
6029 m_signal.append(reader.readElementText());
6032 if (!tag.compare(u"slot"_s, Qt::CaseInsensitive)) {
6033 m_slot.append(reader.readElementText());
6036 reader.raiseError(
"Unexpected element "_L1 + tag);
6039 case QXmlStreamReader::EndElement :
6047void DomSlots::write(QXmlStreamWriter &writer,
const QString &tagName)
const
6049 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"slots") : tagName.toLower());
6051 for (
const QString &v : m_signal)
6052 writer.writeTextElement(u"signal"_s, v);
6054 for (
const QString &v : m_slot)
6055 writer.writeTextElement(u"slot"_s, v);
6057 writer.writeEndElement();
6060void DomSlots::setElementSignal(
const QStringList &a)
6062 m_children |= Signal;
6066void DomSlots::setElementSlot(
const QStringList &a)
6072DomPropertySpecifications::~DomPropertySpecifications()
6074 qDeleteAll(m_tooltip);
6076 qDeleteAll(m_stringpropertyspecification);
6077 m_stringpropertyspecification.clear();
6080void DomPropertySpecifications::read(QXmlStreamReader &reader)
6082 while (!reader.hasError()) {
6083 switch (reader.readNext()) {
6084 case QXmlStreamReader::StartElement : {
6085 const auto tag = reader.name();
6086 if (!tag.compare(u"tooltip"_s, Qt::CaseInsensitive)) {
6087 auto *v =
new DomPropertyToolTip();
6089 m_tooltip.append(v);
6092 if (!tag.compare(u"stringpropertyspecification"_s, Qt::CaseInsensitive)) {
6093 auto *v =
new DomStringPropertySpecification();
6095 m_stringpropertyspecification.append(v);
6098 reader.raiseError(
"Unexpected element "_L1 + tag);
6101 case QXmlStreamReader::EndElement :
6109void DomPropertySpecifications::write(QXmlStreamWriter &writer,
const QString &tagName)
const
6111 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"propertyspecifications") : tagName.toLower());
6113 for (DomPropertyToolTip *v : m_tooltip)
6114 v->write(writer, u"tooltip"_s);
6116 for (DomStringPropertySpecification *v : m_stringpropertyspecification)
6117 v->write(writer, u"stringpropertyspecification"_s);
6119 writer.writeEndElement();
6122void DomPropertySpecifications::setElementTooltip(
const QList<DomPropertyToolTip *> &a)
6124 m_children |= Tooltip;
6128void DomPropertySpecifications::setElementStringpropertyspecification(
const QList<DomStringPropertySpecification *> &a)
6130 m_children |= Stringpropertyspecification;
6131 m_stringpropertyspecification = a;
6134DomPropertyToolTip::~DomPropertyToolTip() =
default;
6136void DomPropertyToolTip::read(QXmlStreamReader &reader)
6138 const QXmlStreamAttributes &attributes = reader.attributes();
6139 for (
const QXmlStreamAttribute &attribute : attributes) {
6140 const auto name = attribute.name();
6141 if (name == u"name"_s) {
6142 setAttributeName(attribute.value().toString());
6145 reader.raiseError(
"Unexpected attribute "_L1 + name);
6148 while (!reader.hasError()) {
6149 switch (reader.readNext()) {
6150 case QXmlStreamReader::StartElement : {
6151 const auto tag = reader.name();
6152 reader.raiseError(
"Unexpected element "_L1 + tag);
6155 case QXmlStreamReader::EndElement :
6163void DomPropertyToolTip::write(QXmlStreamWriter &writer,
const QString &tagName)
const
6165 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"propertytooltip") : tagName.toLower());
6167 if (hasAttributeName())
6168 writer.writeAttribute(u"name"_s, attributeName());
6170 writer.writeEndElement();
6173DomStringPropertySpecification::~DomStringPropertySpecification() =
default;
6175void DomStringPropertySpecification::read(QXmlStreamReader &reader)
6177 const QXmlStreamAttributes &attributes = reader.attributes();
6178 for (
const QXmlStreamAttribute &attribute : attributes) {
6179 const auto name = attribute.name();
6180 if (name == u"name"_s) {
6181 setAttributeName(attribute.value().toString());
6184 if (name == u"type"_s) {
6185 setAttributeType(attribute.value().toString());
6188 if (name == u"notr"_s) {
6189 setAttributeNotr(attribute.value().toString());
6192 reader.raiseError(
"Unexpected attribute "_L1 + name);
6195 while (!reader.hasError()) {
6196 switch (reader.readNext()) {
6197 case QXmlStreamReader::StartElement : {
6198 const auto tag = reader.name();
6199 reader.raiseError(
"Unexpected element "_L1 + tag);
6202 case QXmlStreamReader::EndElement :
6210void DomStringPropertySpecification::write(QXmlStreamWriter &writer,
const QString &tagName)
const
6212 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"stringpropertyspecification") : tagName.toLower());
6214 if (hasAttributeName())
6215 writer.writeAttribute(u"name"_s, attributeName());
6217 if (hasAttributeType())
6218 writer.writeAttribute(u"type"_s, attributeType());
6220 if (hasAttributeNotr())
6221 writer.writeAttribute(u"notr"_s, attributeNotr());
6223 writer.writeEndElement();
Combined button and popup list for selecting options.
#define QStringLiteral(str)