12using namespace Qt::StringLiterals;
14#ifdef QFORMINTERNAL_NAMESPACE
15using namespace QFormInternal;
19
20
25 delete m_layoutDefault;
26 delete m_layoutFunction;
27 delete m_customWidgets;
32 delete m_designerdata;
34 delete m_buttonGroups;
37void DomUI::read(QXmlStreamReader &reader)
39 const QXmlStreamAttributes &attributes = reader.attributes();
40 for (
const QXmlStreamAttribute &attribute : attributes) {
41 const auto name = attribute.name();
42 if (name == u"version"_s) {
43 setAttributeVersion(attribute.value().toString());
46 if (name == u"language"_s) {
47 setAttributeLanguage(attribute.value().toString());
50 if (name == u"displayname"_s) {
51 setAttributeDisplayname(attribute.value().toString());
54 if (name == u"idbasedtr"_s) {
55 setAttributeIdbasedtr(attribute.value() == u"true"_s);
58 if (name == u"label"_s) {
59 setAttributeLabel(attribute.value().toString());
62 if (name == u"connectslotsbyname"_s) {
63 setAttributeConnectslotsbyname(attribute.value() == u"true"_s);
66 if (name == u"stdsetdef"_s) {
67 setAttributeStdsetdef(attribute.value().toInt());
70 if (name == u"stdSetDef"_s) {
71 setAttributeStdSetDef(attribute.value().toInt());
74 reader.raiseError(
"Unexpected attribute "_L1 + name);
77 while (!reader.hasError()) {
78 switch (reader.readNext()) {
79 case QXmlStreamReader::StartElement : {
80 const auto tag = reader.name();
81 if (!tag.compare(u"author"_s, Qt::CaseInsensitive)) {
82 setElementAuthor(reader.readElementText());
85 if (!tag.compare(u"comment"_s, Qt::CaseInsensitive)) {
86 setElementComment(reader.readElementText());
89 if (!tag.compare(u"exportmacro"_s, Qt::CaseInsensitive)) {
90 setElementExportMacro(reader.readElementText());
93 if (!tag.compare(u"class"_s, Qt::CaseInsensitive)) {
94 setElementClass(reader.readElementText());
97 if (!tag.compare(u"widget"_s, Qt::CaseInsensitive)) {
98 auto *v =
new DomWidget();
103 if (!tag.compare(u"layoutdefault"_s, Qt::CaseInsensitive)) {
104 auto *v =
new DomLayoutDefault();
106 setElementLayoutDefault(v);
109 if (!tag.compare(u"layoutfunction"_s, Qt::CaseInsensitive)) {
110 auto *v =
new DomLayoutFunction();
112 setElementLayoutFunction(v);
115 if (!tag.compare(u"pixmapfunction"_s, Qt::CaseInsensitive)) {
116 setElementPixmapFunction(reader.readElementText());
119 if (!tag.compare(u"customwidgets"_s, Qt::CaseInsensitive)) {
120 auto *v =
new DomCustomWidgets();
122 setElementCustomWidgets(v);
125 if (!tag.compare(u"tabstops"_s, Qt::CaseInsensitive)) {
126 auto *v =
new DomTabStops();
128 setElementTabStops(v);
131 if (!tag.compare(u"images"_s, Qt::CaseInsensitive)) {
132 qWarning(
"Omitting deprecated element <images>.");
133 reader.skipCurrentElement();
136 if (!tag.compare(u"includes"_s, Qt::CaseInsensitive)) {
137 auto *v =
new DomIncludes();
139 setElementIncludes(v);
142 if (!tag.compare(u"resources"_s, Qt::CaseInsensitive)) {
143 auto *v =
new DomResources();
145 setElementResources(v);
148 if (!tag.compare(u"connections"_s, Qt::CaseInsensitive)) {
149 auto *v =
new DomConnections();
151 setElementConnections(v);
154 if (!tag.compare(u"designerdata"_s, Qt::CaseInsensitive)) {
155 auto *v =
new DomDesignerData();
157 setElementDesignerdata(v);
160 if (!tag.compare(u"slots"_s, Qt::CaseInsensitive)) {
161 auto *v =
new DomSlots();
166 if (!tag.compare(u"buttongroups"_s, Qt::CaseInsensitive)) {
167 auto *v =
new DomButtonGroups();
169 setElementButtonGroups(v);
172 reader.raiseError(
"Unexpected element "_L1 + tag);
175 case QXmlStreamReader::EndElement :
183void DomUI::write(QXmlStreamWriter &writer,
const QString &tagName)
const
185 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"ui") : tagName.toLower());
187 if (hasAttributeVersion())
188 writer.writeAttribute(u"version"_s, attributeVersion());
190 if (hasAttributeLanguage())
191 writer.writeAttribute(u"language"_s, attributeLanguage());
193 if (hasAttributeDisplayname())
194 writer.writeAttribute(u"displayname"_s, attributeDisplayname());
196 if (hasAttributeIdbasedtr())
197 writer.writeAttribute(u"idbasedtr"_s, (attributeIdbasedtr() ? u"true"_s : u"false"_s));
199 if (hasAttributeLabel())
200 writer.writeAttribute(u"label"_s, attributeLabel());
202 if (hasAttributeConnectslotsbyname())
203 writer.writeAttribute(u"connectslotsbyname"_s, (attributeConnectslotsbyname() ? u"true"_s : u"false"_s));
205 if (hasAttributeStdsetdef())
206 writer.writeAttribute(u"stdsetdef"_s, QString::number(attributeStdsetdef()));
208 if (hasAttributeStdSetDef())
209 writer.writeAttribute(u"stdsetdef"_s, QString::number(attributeStdSetDef()));
211 if (m_children & Author)
212 writer.writeTextElement(u"author"_s, m_author);
214 if (m_children & Comment)
215 writer.writeTextElement(u"comment"_s, m_comment);
217 if (m_children & ExportMacro)
218 writer.writeTextElement(u"exportmacro"_s, m_exportMacro);
220 if (m_children & Class)
221 writer.writeTextElement(u"class"_s, m_class);
223 if (m_children & Widget)
224 m_widget->write(writer, u"widget"_s);
226 if (m_children & LayoutDefault)
227 m_layoutDefault->write(writer, u"layoutdefault"_s);
229 if (m_children & LayoutFunction)
230 m_layoutFunction->write(writer, u"layoutfunction"_s);
232 if (m_children & PixmapFunction)
233 writer.writeTextElement(u"pixmapfunction"_s, m_pixmapFunction);
235 if (m_children & CustomWidgets)
236 m_customWidgets->write(writer, u"customwidgets"_s);
238 if (m_children & TabStops)
239 m_tabStops->write(writer, u"tabstops"_s);
241 if (m_children & Includes)
242 m_includes->write(writer, u"includes"_s);
244 if (m_children & Resources)
245 m_resources->write(writer, u"resources"_s);
247 if (m_children & Connections)
248 m_connections->write(writer, u"connections"_s);
250 if (m_children & Designerdata)
251 m_designerdata->write(writer, u"designerdata"_s);
253 if (m_children & Slots)
254 m_slots->write(writer, u"slots"_s);
256 if (m_children & ButtonGroups)
257 m_buttonGroups->write(writer, u"buttongroups"_s);
259 writer.writeEndElement();
262void DomUI::setElementAuthor(
const QString &a)
264 m_children |= Author;
268void DomUI::setElementComment(
const QString &a)
270 m_children |= Comment;
274void DomUI::setElementExportMacro(
const QString &a)
276 m_children |= ExportMacro;
280void DomUI::setElementClass(
const QString &a)
286DomWidget *DomUI::takeElementWidget()
288 DomWidget *a = m_widget;
290 m_children ^= Widget;
294void DomUI::setElementWidget(DomWidget *a)
297 m_children |= Widget;
301DomLayoutDefault *DomUI::takeElementLayoutDefault()
303 DomLayoutDefault *a = m_layoutDefault;
304 m_layoutDefault =
nullptr;
305 m_children ^= LayoutDefault;
309void DomUI::setElementLayoutDefault(DomLayoutDefault *a)
311 delete m_layoutDefault;
312 m_children |= LayoutDefault;
316DomLayoutFunction *DomUI::takeElementLayoutFunction()
318 DomLayoutFunction *a = m_layoutFunction;
319 m_layoutFunction =
nullptr;
320 m_children ^= LayoutFunction;
324void DomUI::setElementLayoutFunction(DomLayoutFunction *a)
326 delete m_layoutFunction;
327 m_children |= LayoutFunction;
328 m_layoutFunction = a;
331void DomUI::setElementPixmapFunction(
const QString &a)
333 m_children |= PixmapFunction;
334 m_pixmapFunction = a;
337DomCustomWidgets *DomUI::takeElementCustomWidgets()
339 DomCustomWidgets *a = m_customWidgets;
340 m_customWidgets =
nullptr;
341 m_children ^= CustomWidgets;
345void DomUI::setElementCustomWidgets(DomCustomWidgets *a)
347 delete m_customWidgets;
348 m_children |= CustomWidgets;
352DomTabStops *DomUI::takeElementTabStops()
354 DomTabStops *a = m_tabStops;
355 m_tabStops =
nullptr;
356 m_children ^= TabStops;
360void DomUI::setElementTabStops(DomTabStops *a)
363 m_children |= TabStops;
367DomIncludes *DomUI::takeElementIncludes()
369 DomIncludes *a = m_includes;
370 m_includes =
nullptr;
371 m_children ^= Includes;
375void DomUI::setElementIncludes(DomIncludes *a)
378 m_children |= Includes;
382DomResources *DomUI::takeElementResources()
384 DomResources *a = m_resources;
385 m_resources =
nullptr;
386 m_children ^= Resources;
390void DomUI::setElementResources(DomResources *a)
393 m_children |= Resources;
397DomConnections *DomUI::takeElementConnections()
399 DomConnections *a = m_connections;
400 m_connections =
nullptr;
401 m_children ^= Connections;
405void DomUI::setElementConnections(DomConnections *a)
407 delete m_connections;
408 m_children |= Connections;
412DomDesignerData *DomUI::takeElementDesignerdata()
414 DomDesignerData *a = m_designerdata;
415 m_designerdata =
nullptr;
416 m_children ^= Designerdata;
420void DomUI::setElementDesignerdata(DomDesignerData *a)
422 delete m_designerdata;
423 m_children |= Designerdata;
427DomSlots *DomUI::takeElementSlots()
429 DomSlots *a = m_slots;
435void DomUI::setElementSlots(DomSlots *a)
442DomButtonGroups *DomUI::takeElementButtonGroups()
444 DomButtonGroups *a = m_buttonGroups;
445 m_buttonGroups =
nullptr;
446 m_children ^= ButtonGroups;
450void DomUI::setElementButtonGroups(DomButtonGroups *a)
452 delete m_buttonGroups;
453 m_children |= ButtonGroups;
457void DomUI::clearElementAuthor()
459 m_children &= ~Author;
462void DomUI::clearElementComment()
464 m_children &= ~Comment;
467void DomUI::clearElementExportMacro()
469 m_children &= ~ExportMacro;
472void DomUI::clearElementClass()
474 m_children &= ~Class;
477void DomUI::clearElementWidget()
481 m_children &= ~Widget;
484void DomUI::clearElementLayoutDefault()
486 delete m_layoutDefault;
487 m_layoutDefault =
nullptr;
488 m_children &= ~LayoutDefault;
491void DomUI::clearElementLayoutFunction()
493 delete m_layoutFunction;
494 m_layoutFunction =
nullptr;
495 m_children &= ~LayoutFunction;
498void DomUI::clearElementPixmapFunction()
500 m_children &= ~PixmapFunction;
503void DomUI::clearElementCustomWidgets()
505 delete m_customWidgets;
506 m_customWidgets =
nullptr;
507 m_children &= ~CustomWidgets;
510void DomUI::clearElementTabStops()
513 m_tabStops =
nullptr;
514 m_children &= ~TabStops;
517void DomUI::clearElementIncludes()
520 m_includes =
nullptr;
521 m_children &= ~Includes;
524void DomUI::clearElementResources()
527 m_resources =
nullptr;
528 m_children &= ~Resources;
531void DomUI::clearElementConnections()
533 delete m_connections;
534 m_connections =
nullptr;
535 m_children &= ~Connections;
538void DomUI::clearElementDesignerdata()
540 delete m_designerdata;
541 m_designerdata =
nullptr;
542 m_children &= ~Designerdata;
545void DomUI::clearElementSlots()
549 m_children &= ~Slots;
552void DomUI::clearElementButtonGroups()
554 delete m_buttonGroups;
555 m_buttonGroups =
nullptr;
556 m_children &= ~ButtonGroups;
559DomIncludes::~DomIncludes()
561 qDeleteAll(m_include);
565void DomIncludes::read(QXmlStreamReader &reader)
567 while (!reader.hasError()) {
568 switch (reader.readNext()) {
569 case QXmlStreamReader::StartElement : {
570 const auto tag = reader.name();
571 if (!tag.compare(u"include"_s, Qt::CaseInsensitive)) {
572 auto *v =
new DomInclude();
577 reader.raiseError(
"Unexpected element "_L1 + tag);
580 case QXmlStreamReader::EndElement :
588void DomIncludes::write(QXmlStreamWriter &writer,
const QString &tagName)
const
590 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"includes") : tagName.toLower());
592 for (DomInclude *v : m_include)
593 v->write(writer, u"include"_s);
595 writer.writeEndElement();
598void DomIncludes::setElementInclude(
const QList<DomInclude *> &a)
600 m_children |= Include;
604DomInclude::~DomInclude() =
default;
606void DomInclude::read(QXmlStreamReader &reader)
608 const QXmlStreamAttributes &attributes = reader.attributes();
609 for (
const QXmlStreamAttribute &attribute : attributes) {
610 const auto name = attribute.name();
611 if (name == u"location"_s) {
612 setAttributeLocation(attribute.value().toString());
615 if (name == u"impldecl"_s) {
616 setAttributeImpldecl(attribute.value().toString());
619 reader.raiseError(
"Unexpected attribute "_L1 + name);
622 while (!reader.hasError()) {
623 switch (reader.readNext()) {
624 case QXmlStreamReader::StartElement : {
625 const auto tag = reader.name();
626 reader.raiseError(
"Unexpected element "_L1 + tag);
629 case QXmlStreamReader::EndElement :
631 case QXmlStreamReader::Characters :
632 if (!reader.isWhitespace())
633 m_text.append(reader.text().toString());
641void DomInclude::write(QXmlStreamWriter &writer,
const QString &tagName)
const
643 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"include") : tagName.toLower());
645 if (hasAttributeLocation())
646 writer.writeAttribute(u"location"_s, attributeLocation());
648 if (hasAttributeImpldecl())
649 writer.writeAttribute(u"impldecl"_s, attributeImpldecl());
651 if (!m_text.isEmpty())
652 writer.writeCharacters(m_text);
654 writer.writeEndElement();
657DomResources::~DomResources()
659 qDeleteAll(m_include);
663void DomResources::read(QXmlStreamReader &reader)
665 const QXmlStreamAttributes &attributes = reader.attributes();
666 for (
const QXmlStreamAttribute &attribute : attributes) {
667 const auto name = attribute.name();
668 if (name == u"name"_s) {
669 setAttributeName(attribute.value().toString());
672 reader.raiseError(
"Unexpected attribute "_L1 + name);
675 while (!reader.hasError()) {
676 switch (reader.readNext()) {
677 case QXmlStreamReader::StartElement : {
678 const auto tag = reader.name();
679 if (!tag.compare(u"include"_s, Qt::CaseInsensitive)) {
680 auto *v =
new DomResource();
685 reader.raiseError(
"Unexpected element "_L1 + tag);
688 case QXmlStreamReader::EndElement :
696void DomResources::write(QXmlStreamWriter &writer,
const QString &tagName)
const
698 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"resources") : tagName.toLower());
700 if (hasAttributeName())
701 writer.writeAttribute(u"name"_s, attributeName());
703 for (DomResource *v : m_include)
704 v->write(writer, u"include"_s);
706 writer.writeEndElement();
709void DomResources::setElementInclude(
const QList<DomResource *> &a)
711 m_children |= Include;
715DomResource::~DomResource() =
default;
717void DomResource::read(QXmlStreamReader &reader)
719 const QXmlStreamAttributes &attributes = reader.attributes();
720 for (
const QXmlStreamAttribute &attribute : attributes) {
721 const auto name = attribute.name();
722 if (name == u"location"_s) {
723 setAttributeLocation(attribute.value().toString());
726 reader.raiseError(
"Unexpected attribute "_L1 + name);
729 while (!reader.hasError()) {
730 switch (reader.readNext()) {
731 case QXmlStreamReader::StartElement : {
732 const auto tag = reader.name();
733 reader.raiseError(
"Unexpected element "_L1 + tag);
736 case QXmlStreamReader::EndElement :
744void DomResource::write(QXmlStreamWriter &writer,
const QString &tagName)
const
746 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"resource") : tagName.toLower());
748 if (hasAttributeLocation())
749 writer.writeAttribute(u"location"_s, attributeLocation());
751 writer.writeEndElement();
754DomActionGroup::~DomActionGroup()
756 qDeleteAll(m_action);
758 qDeleteAll(m_actionGroup);
759 m_actionGroup.clear();
760 qDeleteAll(m_property);
762 qDeleteAll(m_attribute);
766void DomActionGroup::read(QXmlStreamReader &reader)
768 const QXmlStreamAttributes &attributes = reader.attributes();
769 for (
const QXmlStreamAttribute &attribute : attributes) {
770 const auto name = attribute.name();
771 if (name == u"name"_s) {
772 setAttributeName(attribute.value().toString());
775 reader.raiseError(
"Unexpected attribute "_L1 + name);
778 while (!reader.hasError()) {
779 switch (reader.readNext()) {
780 case QXmlStreamReader::StartElement : {
781 const auto tag = reader.name();
782 if (!tag.compare(u"action"_s, Qt::CaseInsensitive)) {
783 auto *v =
new DomAction();
788 if (!tag.compare(u"actiongroup"_s, Qt::CaseInsensitive)) {
789 auto *v =
new DomActionGroup();
791 m_actionGroup.append(v);
794 if (!tag.compare(u"property"_s, Qt::CaseInsensitive)) {
795 auto *v =
new DomProperty();
797 m_property.append(v);
800 if (!tag.compare(u"attribute"_s, Qt::CaseInsensitive)) {
801 auto *v =
new DomProperty();
803 m_attribute.append(v);
806 reader.raiseError(
"Unexpected element "_L1 + tag);
809 case QXmlStreamReader::EndElement :
817void DomActionGroup::write(QXmlStreamWriter &writer,
const QString &tagName)
const
819 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"actiongroup") : tagName.toLower());
821 if (hasAttributeName())
822 writer.writeAttribute(u"name"_s, attributeName());
824 for (DomAction *v : m_action)
825 v->write(writer, u"action"_s);
827 for (DomActionGroup *v : m_actionGroup)
828 v->write(writer, u"actiongroup"_s);
830 for (DomProperty *v : m_property)
831 v->write(writer, u"property"_s);
833 for (DomProperty *v : m_attribute)
834 v->write(writer, u"attribute"_s);
836 writer.writeEndElement();
839void DomActionGroup::setElementAction(
const QList<DomAction *> &a)
841 m_children |= Action;
845void DomActionGroup::setElementActionGroup(
const QList<DomActionGroup *> &a)
847 m_children |= ActionGroup;
851void DomActionGroup::setElementProperty(
const QList<DomProperty *> &a)
853 m_children |= Property;
857void DomActionGroup::setElementAttribute(
const QList<DomProperty *> &a)
859 m_children |= Attribute;
863DomAction::~DomAction()
865 qDeleteAll(m_property);
867 qDeleteAll(m_attribute);
871void DomAction::read(QXmlStreamReader &reader)
873 const QXmlStreamAttributes &attributes = reader.attributes();
874 for (
const QXmlStreamAttribute &attribute : attributes) {
875 const auto name = attribute.name();
876 if (name == u"name"_s) {
877 setAttributeName(attribute.value().toString());
880 if (name == u"menu"_s) {
881 setAttributeMenu(attribute.value().toString());
884 reader.raiseError(
"Unexpected attribute "_L1 + name);
887 while (!reader.hasError()) {
888 switch (reader.readNext()) {
889 case QXmlStreamReader::StartElement : {
890 const auto tag = reader.name();
891 if (!tag.compare(u"property"_s, Qt::CaseInsensitive)) {
892 auto *v =
new DomProperty();
894 m_property.append(v);
897 if (!tag.compare(u"attribute"_s, Qt::CaseInsensitive)) {
898 auto *v =
new DomProperty();
900 m_attribute.append(v);
903 reader.raiseError(
"Unexpected element "_L1 + tag);
906 case QXmlStreamReader::EndElement :
914void DomAction::write(QXmlStreamWriter &writer,
const QString &tagName)
const
916 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"action") : tagName.toLower());
918 if (hasAttributeName())
919 writer.writeAttribute(u"name"_s, attributeName());
921 if (hasAttributeMenu())
922 writer.writeAttribute(u"menu"_s, attributeMenu());
924 for (DomProperty *v : m_property)
925 v->write(writer, u"property"_s);
927 for (DomProperty *v : m_attribute)
928 v->write(writer, u"attribute"_s);
930 writer.writeEndElement();
933void DomAction::setElementProperty(
const QList<DomProperty *> &a)
935 m_children |= Property;
939void DomAction::setElementAttribute(
const QList<DomProperty *> &a)
941 m_children |= Attribute;
945DomActionRef::~DomActionRef() =
default;
947void DomActionRef::read(QXmlStreamReader &reader)
949 const QXmlStreamAttributes &attributes = reader.attributes();
950 for (
const QXmlStreamAttribute &attribute : attributes) {
951 const auto name = attribute.name();
952 if (name == u"name"_s) {
953 setAttributeName(attribute.value().toString());
956 reader.raiseError(
"Unexpected attribute "_L1 + name);
959 while (!reader.hasError()) {
960 switch (reader.readNext()) {
961 case QXmlStreamReader::StartElement : {
962 const auto tag = reader.name();
963 reader.raiseError(
"Unexpected element "_L1 + tag);
966 case QXmlStreamReader::EndElement :
974void DomActionRef::write(QXmlStreamWriter &writer,
const QString &tagName)
const
976 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"actionref") : tagName.toLower());
978 if (hasAttributeName())
979 writer.writeAttribute(u"name"_s, attributeName());
981 writer.writeEndElement();
984DomButtonGroup::~DomButtonGroup()
986 qDeleteAll(m_property);
988 qDeleteAll(m_attribute);
992void DomButtonGroup::read(QXmlStreamReader &reader)
994 const QXmlStreamAttributes &attributes = reader.attributes();
995 for (
const QXmlStreamAttribute &attribute : attributes) {
996 const auto name = attribute.name();
997 if (name == u"name"_s) {
998 setAttributeName(attribute.value().toString());
1001 reader.raiseError(
"Unexpected attribute "_L1 + name);
1004 while (!reader.hasError()) {
1005 switch (reader.readNext()) {
1006 case QXmlStreamReader::StartElement : {
1007 const auto tag = reader.name();
1008 if (!tag.compare(u"property"_s, Qt::CaseInsensitive)) {
1009 auto *v =
new DomProperty();
1011 m_property.append(v);
1014 if (!tag.compare(u"attribute"_s, Qt::CaseInsensitive)) {
1015 auto *v =
new DomProperty();
1017 m_attribute.append(v);
1020 reader.raiseError(
"Unexpected element "_L1 + tag);
1023 case QXmlStreamReader::EndElement :
1031void DomButtonGroup::write(QXmlStreamWriter &writer,
const QString &tagName)
const
1033 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"buttongroup") : tagName.toLower());
1035 if (hasAttributeName())
1036 writer.writeAttribute(u"name"_s, attributeName());
1038 for (DomProperty *v : m_property)
1039 v->write(writer, u"property"_s);
1041 for (DomProperty *v : m_attribute)
1042 v->write(writer, u"attribute"_s);
1044 writer.writeEndElement();
1047void DomButtonGroup::setElementProperty(
const QList<DomProperty *> &a)
1049 m_children |= Property;
1053void DomButtonGroup::setElementAttribute(
const QList<DomProperty *> &a)
1055 m_children |= Attribute;
1059DomButtonGroups::~DomButtonGroups()
1061 qDeleteAll(m_buttonGroup);
1062 m_buttonGroup.clear();
1065void DomButtonGroups::read(QXmlStreamReader &reader)
1067 while (!reader.hasError()) {
1068 switch (reader.readNext()) {
1069 case QXmlStreamReader::StartElement : {
1070 const auto tag = reader.name();
1071 if (!tag.compare(u"buttongroup"_s, Qt::CaseInsensitive)) {
1072 auto *v =
new DomButtonGroup();
1074 m_buttonGroup.append(v);
1077 reader.raiseError(
"Unexpected element "_L1 + tag);
1080 case QXmlStreamReader::EndElement :
1088void DomButtonGroups::write(QXmlStreamWriter &writer,
const QString &tagName)
const
1090 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"buttongroups") : tagName.toLower());
1092 for (DomButtonGroup *v : m_buttonGroup)
1093 v->write(writer, u"buttongroup"_s);
1095 writer.writeEndElement();
1098void DomButtonGroups::setElementButtonGroup(
const QList<DomButtonGroup *> &a)
1100 m_children |= ButtonGroup;
1104DomCustomWidgets::~DomCustomWidgets()
1106 qDeleteAll(m_customWidget);
1107 m_customWidget.clear();
1110void DomCustomWidgets::read(QXmlStreamReader &reader)
1112 while (!reader.hasError()) {
1113 switch (reader.readNext()) {
1114 case QXmlStreamReader::StartElement : {
1115 const auto tag = reader.name();
1116 if (!tag.compare(u"customwidget"_s, Qt::CaseInsensitive)) {
1117 auto *v =
new DomCustomWidget();
1119 m_customWidget.append(v);
1122 reader.raiseError(
"Unexpected element "_L1 + tag);
1125 case QXmlStreamReader::EndElement :
1133void DomCustomWidgets::write(QXmlStreamWriter &writer,
const QString &tagName)
const
1135 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"customwidgets") : tagName.toLower());
1137 for (DomCustomWidget *v : m_customWidget)
1138 v->write(writer, u"customwidget"_s);
1140 writer.writeEndElement();
1143void DomCustomWidgets::setElementCustomWidget(
const QList<DomCustomWidget *> &a)
1145 m_children |= CustomWidget;
1149DomHeader::~DomHeader() =
default;
1151void DomHeader::read(QXmlStreamReader &reader)
1153 const QXmlStreamAttributes &attributes = reader.attributes();
1154 for (
const QXmlStreamAttribute &attribute : attributes) {
1155 const auto name = attribute.name();
1156 if (name == u"location"_s) {
1157 setAttributeLocation(attribute.value().toString());
1160 reader.raiseError(
"Unexpected attribute "_L1 + name);
1163 while (!reader.hasError()) {
1164 switch (reader.readNext()) {
1165 case QXmlStreamReader::StartElement : {
1166 const auto tag = reader.name();
1167 reader.raiseError(
"Unexpected element "_L1 + tag);
1170 case QXmlStreamReader::EndElement :
1172 case QXmlStreamReader::Characters :
1173 if (!reader.isWhitespace())
1174 m_text.append(reader.text().toString());
1182void DomHeader::write(QXmlStreamWriter &writer,
const QString &tagName)
const
1184 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"header") : tagName.toLower());
1186 if (hasAttributeLocation())
1187 writer.writeAttribute(u"location"_s, attributeLocation());
1189 if (!m_text.isEmpty())
1190 writer.writeCharacters(m_text);
1192 writer.writeEndElement();
1195DomCustomWidget::~DomCustomWidget()
1200 delete m_propertyspecifications;
1203void DomCustomWidget::read(QXmlStreamReader &reader)
1205 while (!reader.hasError()) {
1206 switch (reader.readNext()) {
1207 case QXmlStreamReader::StartElement : {
1208 const auto tag = reader.name();
1209 if (!tag.compare(u"class"_s, Qt::CaseInsensitive)) {
1210 setElementClass(reader.readElementText());
1213 if (!tag.compare(u"extends"_s, Qt::CaseInsensitive)) {
1214 setElementExtends(reader.readElementText());
1217 if (!tag.compare(u"header"_s, Qt::CaseInsensitive)) {
1218 auto *v =
new DomHeader();
1220 setElementHeader(v);
1223 if (!tag.compare(u"sizehint"_s, Qt::CaseInsensitive)) {
1224 auto *v =
new DomSize();
1226 setElementSizeHint(v);
1229 if (!tag.compare(u"addpagemethod"_s, Qt::CaseInsensitive)) {
1230 setElementAddPageMethod(reader.readElementText());
1233 if (!tag.compare(u"container"_s, Qt::CaseInsensitive)) {
1234 setElementContainer(reader.readElementText().toInt());
1237 if (!tag.compare(u"sizepolicy"_s, Qt::CaseInsensitive)) {
1238 qWarning(
"Omitting deprecated element <sizepolicy>.");
1239 reader.skipCurrentElement();
1242 if (!tag.compare(u"pixmap"_s, Qt::CaseInsensitive)) {
1243 setElementPixmap(reader.readElementText());
1246 if (!tag.compare(u"script"_s, Qt::CaseInsensitive)) {
1247 qWarning(
"Omitting deprecated element <script>.");
1248 reader.skipCurrentElement();
1251 if (!tag.compare(u"properties"_s, Qt::CaseInsensitive)) {
1252 qWarning(
"Omitting deprecated element <properties>.");
1253 reader.skipCurrentElement();
1256 if (!tag.compare(u"slots"_s, Qt::CaseInsensitive)) {
1257 auto *v =
new DomSlots();
1262 if (!tag.compare(u"propertyspecifications"_s, Qt::CaseInsensitive)) {
1263 auto *v =
new DomPropertySpecifications();
1265 setElementPropertyspecifications(v);
1268 reader.raiseError(
"Unexpected element "_L1 + tag);
1271 case QXmlStreamReader::EndElement :
1279void DomCustomWidget::write(QXmlStreamWriter &writer,
const QString &tagName)
const
1281 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"customwidget") : tagName.toLower());
1283 if (m_children & Class)
1284 writer.writeTextElement(u"class"_s, m_class);
1286 if (m_children & Extends)
1287 writer.writeTextElement(u"extends"_s, m_extends);
1289 if (m_children & Header)
1290 m_header->write(writer, u"header"_s);
1292 if (m_children & SizeHint)
1293 m_sizeHint->write(writer, u"sizehint"_s);
1295 if (m_children & AddPageMethod)
1296 writer.writeTextElement(u"addpagemethod"_s, m_addPageMethod);
1298 if (m_children & Container)
1299 writer.writeTextElement(u"container"_s, QString::number(m_container));
1301 if (m_children & Pixmap)
1302 writer.writeTextElement(u"pixmap"_s, m_pixmap);
1304 if (m_children & Slots)
1305 m_slots->write(writer, u"slots"_s);
1307 if (m_children & Propertyspecifications)
1308 m_propertyspecifications->write(writer, u"propertyspecifications"_s);
1310 writer.writeEndElement();
1313void DomCustomWidget::setElementClass(
const QString &a)
1315 m_children |= Class;
1319void DomCustomWidget::setElementExtends(
const QString &a)
1321 m_children |= Extends;
1325DomHeader *DomCustomWidget::takeElementHeader()
1327 DomHeader *a = m_header;
1329 m_children ^= Header;
1333void DomCustomWidget::setElementHeader(DomHeader *a)
1336 m_children |= Header;
1340DomSize *DomCustomWidget::takeElementSizeHint()
1342 DomSize *a = m_sizeHint;
1343 m_sizeHint =
nullptr;
1344 m_children ^= SizeHint;
1348void DomCustomWidget::setElementSizeHint(DomSize *a)
1351 m_children |= SizeHint;
1355void DomCustomWidget::setElementAddPageMethod(
const QString &a)
1357 m_children |= AddPageMethod;
1358 m_addPageMethod = a;
1361void DomCustomWidget::setElementContainer(
int a)
1363 m_children |= Container;
1367void DomCustomWidget::setElementPixmap(
const QString &a)
1369 m_children |= Pixmap;
1373DomSlots *DomCustomWidget::takeElementSlots()
1375 DomSlots *a = m_slots;
1377 m_children ^= Slots;
1381void DomCustomWidget::setElementSlots(DomSlots *a)
1384 m_children |= Slots;
1388DomPropertySpecifications *DomCustomWidget::takeElementPropertyspecifications()
1390 DomPropertySpecifications *a = m_propertyspecifications;
1391 m_propertyspecifications =
nullptr;
1392 m_children ^= Propertyspecifications;
1396void DomCustomWidget::setElementPropertyspecifications(DomPropertySpecifications *a)
1398 delete m_propertyspecifications;
1399 m_children |= Propertyspecifications;
1400 m_propertyspecifications = a;
1403void DomCustomWidget::clearElementClass()
1405 m_children &= ~Class;
1408void DomCustomWidget::clearElementExtends()
1410 m_children &= ~Extends;
1413void DomCustomWidget::clearElementHeader()
1417 m_children &= ~Header;
1420void DomCustomWidget::clearElementSizeHint()
1423 m_sizeHint =
nullptr;
1424 m_children &= ~SizeHint;
1427void DomCustomWidget::clearElementAddPageMethod()
1429 m_children &= ~AddPageMethod;
1432void DomCustomWidget::clearElementContainer()
1434 m_children &= ~Container;
1437void DomCustomWidget::clearElementPixmap()
1439 m_children &= ~Pixmap;
1442void DomCustomWidget::clearElementSlots()
1446 m_children &= ~Slots;
1449void DomCustomWidget::clearElementPropertyspecifications()
1451 delete m_propertyspecifications;
1452 m_propertyspecifications =
nullptr;
1453 m_children &= ~Propertyspecifications;
1456DomLayoutDefault::~DomLayoutDefault() =
default;
1458void DomLayoutDefault::read(QXmlStreamReader &reader)
1460 const QXmlStreamAttributes &attributes = reader.attributes();
1461 for (
const QXmlStreamAttribute &attribute : attributes) {
1462 const auto name = attribute.name();
1463 if (name == u"spacing"_s) {
1464 setAttributeSpacing(attribute.value().toInt());
1467 if (name == u"margin"_s) {
1468 setAttributeMargin(attribute.value().toInt());
1471 reader.raiseError(
"Unexpected attribute "_L1 + name);
1474 while (!reader.hasError()) {
1475 switch (reader.readNext()) {
1476 case QXmlStreamReader::StartElement : {
1477 const auto tag = reader.name();
1478 reader.raiseError(
"Unexpected element "_L1 + tag);
1481 case QXmlStreamReader::EndElement :
1489void DomLayoutDefault::write(QXmlStreamWriter &writer,
const QString &tagName)
const
1491 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"layoutdefault") : tagName.toLower());
1493 if (hasAttributeSpacing())
1494 writer.writeAttribute(u"spacing"_s, QString::number(attributeSpacing()));
1496 if (hasAttributeMargin())
1497 writer.writeAttribute(u"margin"_s, QString::number(attributeMargin()));
1499 writer.writeEndElement();
1502DomLayoutFunction::~DomLayoutFunction() =
default;
1504void DomLayoutFunction::read(QXmlStreamReader &reader)
1506 const QXmlStreamAttributes &attributes = reader.attributes();
1507 for (
const QXmlStreamAttribute &attribute : attributes) {
1508 const auto name = attribute.name();
1509 if (name == u"spacing"_s) {
1510 setAttributeSpacing(attribute.value().toString());
1513 if (name == u"margin"_s) {
1514 setAttributeMargin(attribute.value().toString());
1517 reader.raiseError(
"Unexpected attribute "_L1 + name);
1520 while (!reader.hasError()) {
1521 switch (reader.readNext()) {
1522 case QXmlStreamReader::StartElement : {
1523 const auto tag = reader.name();
1524 reader.raiseError(
"Unexpected element "_L1 + tag);
1527 case QXmlStreamReader::EndElement :
1535void DomLayoutFunction::write(QXmlStreamWriter &writer,
const QString &tagName)
const
1537 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"layoutfunction") : tagName.toLower());
1539 if (hasAttributeSpacing())
1540 writer.writeAttribute(u"spacing"_s, attributeSpacing());
1542 if (hasAttributeMargin())
1543 writer.writeAttribute(u"margin"_s, attributeMargin());
1545 writer.writeEndElement();
1548DomTabStops::~DomTabStops()
1553void DomTabStops::read(QXmlStreamReader &reader)
1555 while (!reader.hasError()) {
1556 switch (reader.readNext()) {
1557 case QXmlStreamReader::StartElement : {
1558 const auto tag = reader.name();
1559 if (!tag.compare(u"tabstop"_s, Qt::CaseInsensitive)) {
1560 m_tabStop.append(reader.readElementText());
1563 reader.raiseError(
"Unexpected element "_L1 + tag);
1566 case QXmlStreamReader::EndElement :
1574void DomTabStops::write(QXmlStreamWriter &writer,
const QString &tagName)
const
1576 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"tabstops") : tagName.toLower());
1578 for (
const QString &v : m_tabStop)
1579 writer.writeTextElement(u"tabstop"_s, v);
1581 writer.writeEndElement();
1584void DomTabStops::setElementTabStop(
const QStringList &a)
1586 m_children |= TabStop;
1590DomLayout::~DomLayout()
1592 qDeleteAll(m_property);
1594 qDeleteAll(m_attribute);
1595 m_attribute.clear();
1600void DomLayout::read(QXmlStreamReader &reader)
1602 const QXmlStreamAttributes &attributes = reader.attributes();
1603 for (
const QXmlStreamAttribute &attribute : attributes) {
1604 const auto name = attribute.name();
1605 if (name == u"class"_s) {
1606 setAttributeClass(attribute.value().toString());
1609 if (name == u"name"_s) {
1610 setAttributeName(attribute.value().toString());
1613 if (name == u"stretch"_s) {
1614 setAttributeStretch(attribute.value().toString());
1617 if (name == u"rowstretch"_s) {
1618 setAttributeRowStretch(attribute.value().toString());
1621 if (name == u"columnstretch"_s) {
1622 setAttributeColumnStretch(attribute.value().toString());
1625 if (name == u"rowminimumheight"_s) {
1626 setAttributeRowMinimumHeight(attribute.value().toString());
1629 if (name == u"columnminimumwidth"_s) {
1630 setAttributeColumnMinimumWidth(attribute.value().toString());
1633 reader.raiseError(
"Unexpected attribute "_L1 + name);
1636 while (!reader.hasError()) {
1637 switch (reader.readNext()) {
1638 case QXmlStreamReader::StartElement : {
1639 const auto tag = reader.name();
1640 if (!tag.compare(u"property"_s, Qt::CaseInsensitive)) {
1641 auto *v =
new DomProperty();
1643 m_property.append(v);
1646 if (!tag.compare(u"attribute"_s, Qt::CaseInsensitive)) {
1647 auto *v =
new DomProperty();
1649 m_attribute.append(v);
1652 if (!tag.compare(u"item"_s, Qt::CaseInsensitive)) {
1653 auto *v =
new DomLayoutItem();
1658 reader.raiseError(
"Unexpected element "_L1 + tag);
1661 case QXmlStreamReader::EndElement :
1669void DomLayout::write(QXmlStreamWriter &writer,
const QString &tagName)
const
1671 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"layout") : tagName.toLower());
1673 if (hasAttributeClass())
1674 writer.writeAttribute(u"class"_s, attributeClass());
1676 if (hasAttributeName())
1677 writer.writeAttribute(u"name"_s, attributeName());
1679 if (hasAttributeStretch())
1680 writer.writeAttribute(u"stretch"_s, attributeStretch());
1682 if (hasAttributeRowStretch())
1683 writer.writeAttribute(u"rowstretch"_s, attributeRowStretch());
1685 if (hasAttributeColumnStretch())
1686 writer.writeAttribute(u"columnstretch"_s, attributeColumnStretch());
1688 if (hasAttributeRowMinimumHeight())
1689 writer.writeAttribute(u"rowminimumheight"_s, attributeRowMinimumHeight());
1691 if (hasAttributeColumnMinimumWidth())
1692 writer.writeAttribute(u"columnminimumwidth"_s, attributeColumnMinimumWidth());
1694 for (DomProperty *v : m_property)
1695 v->write(writer, u"property"_s);
1697 for (DomProperty *v : m_attribute)
1698 v->write(writer, u"attribute"_s);
1700 for (DomLayoutItem *v : m_item)
1701 v->write(writer, u"item"_s);
1703 writer.writeEndElement();
1706void DomLayout::setElementProperty(
const QList<DomProperty *> &a)
1708 m_children |= Property;
1712void DomLayout::setElementAttribute(
const QList<DomProperty *> &a)
1714 m_children |= Attribute;
1718void DomLayout::setElementItem(
const QList<DomLayoutItem *> &a)
1724DomLayoutItem::~DomLayoutItem()
1731void DomLayoutItem::clear()
1744void DomLayoutItem::read(QXmlStreamReader &reader)
1746 const QXmlStreamAttributes &attributes = reader.attributes();
1747 for (
const QXmlStreamAttribute &attribute : attributes) {
1748 const auto name = attribute.name();
1749 if (name == u"row"_s) {
1750 setAttributeRow(attribute.value().toInt());
1753 if (name == u"column"_s) {
1754 setAttributeColumn(attribute.value().toInt());
1757 if (name == u"rowspan"_s) {
1758 setAttributeRowSpan(attribute.value().toInt());
1761 if (name == u"colspan"_s) {
1762 setAttributeColSpan(attribute.value().toInt());
1765 if (name == u"alignment"_s) {
1766 setAttributeAlignment(attribute.value().toString());
1769 reader.raiseError(
"Unexpected attribute "_L1 + name);
1772 while (!reader.hasError()) {
1773 switch (reader.readNext()) {
1774 case QXmlStreamReader::StartElement : {
1775 const auto tag = reader.name();
1776 if (!tag.compare(u"widget"_s, Qt::CaseInsensitive)) {
1777 auto *v =
new DomWidget();
1779 setElementWidget(v);
1782 if (!tag.compare(u"layout"_s, Qt::CaseInsensitive)) {
1783 auto *v =
new DomLayout();
1785 setElementLayout(v);
1788 if (!tag.compare(u"spacer"_s, Qt::CaseInsensitive)) {
1789 auto *v =
new DomSpacer();
1791 setElementSpacer(v);
1794 reader.raiseError(
"Unexpected element "_L1 + tag);
1797 case QXmlStreamReader::EndElement :
1805void DomLayoutItem::write(QXmlStreamWriter &writer,
const QString &tagName)
const
1807 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"layoutitem") : tagName.toLower());
1809 if (hasAttributeRow())
1810 writer.writeAttribute(u"row"_s, QString::number(attributeRow()));
1812 if (hasAttributeColumn())
1813 writer.writeAttribute(u"column"_s, QString::number(attributeColumn()));
1815 if (hasAttributeRowSpan())
1816 writer.writeAttribute(u"rowspan"_s, QString::number(attributeRowSpan()));
1818 if (hasAttributeColSpan())
1819 writer.writeAttribute(u"colspan"_s, QString::number(attributeColSpan()));
1821 if (hasAttributeAlignment())
1822 writer.writeAttribute(u"alignment"_s, attributeAlignment());
1826 if (m_widget !=
nullptr)
1827 m_widget->write(writer, u"widget"_s);
1831 if (m_layout !=
nullptr)
1832 m_layout->write(writer, u"layout"_s);
1836 if (m_spacer !=
nullptr)
1837 m_spacer->write(writer, u"spacer"_s);
1843 writer.writeEndElement();
1846DomWidget *DomLayoutItem::takeElementWidget()
1848 DomWidget *a = m_widget;
1853void DomLayoutItem::setElementWidget(DomWidget *a)
1860DomLayout *DomLayoutItem::takeElementLayout()
1862 DomLayout *a = m_layout;
1867void DomLayoutItem::setElementLayout(DomLayout *a)
1874DomSpacer *DomLayoutItem::takeElementSpacer()
1876 DomSpacer *a = m_spacer;
1881void DomLayoutItem::setElementSpacer(DomSpacer *a)
1890 qDeleteAll(m_property);
1894void DomRow::read(QXmlStreamReader &reader)
1896 while (!reader.hasError()) {
1897 switch (reader.readNext()) {
1898 case QXmlStreamReader::StartElement : {
1899 const auto tag = reader.name();
1900 if (!tag.compare(u"property"_s, Qt::CaseInsensitive)) {
1901 auto *v =
new DomProperty();
1903 m_property.append(v);
1906 reader.raiseError(
"Unexpected element "_L1 + tag);
1909 case QXmlStreamReader::EndElement :
1917void DomRow::write(QXmlStreamWriter &writer,
const QString &tagName)
const
1919 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"row") : tagName.toLower());
1921 for (DomProperty *v : m_property)
1922 v->write(writer, u"property"_s);
1924 writer.writeEndElement();
1927void DomRow::setElementProperty(
const QList<DomProperty *> &a)
1929 m_children |= Property;
1933DomColumn::~DomColumn()
1935 qDeleteAll(m_property);
1939void DomColumn::read(QXmlStreamReader &reader)
1941 while (!reader.hasError()) {
1942 switch (reader.readNext()) {
1943 case QXmlStreamReader::StartElement : {
1944 const auto tag = reader.name();
1945 if (!tag.compare(u"property"_s, Qt::CaseInsensitive)) {
1946 auto *v =
new DomProperty();
1948 m_property.append(v);
1951 reader.raiseError(
"Unexpected element "_L1 + tag);
1954 case QXmlStreamReader::EndElement :
1962void DomColumn::write(QXmlStreamWriter &writer,
const QString &tagName)
const
1964 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"column") : tagName.toLower());
1966 for (DomProperty *v : m_property)
1967 v->write(writer, u"property"_s);
1969 writer.writeEndElement();
1972void DomColumn::setElementProperty(
const QList<DomProperty *> &a)
1974 m_children |= Property;
1980 qDeleteAll(m_property);
1986void DomItem::read(QXmlStreamReader &reader)
1988 const QXmlStreamAttributes &attributes = reader.attributes();
1989 for (
const QXmlStreamAttribute &attribute : attributes) {
1990 const auto name = attribute.name();
1991 if (name == u"row"_s) {
1992 setAttributeRow(attribute.value().toInt());
1995 if (name == u"column"_s) {
1996 setAttributeColumn(attribute.value().toInt());
1999 reader.raiseError(
"Unexpected attribute "_L1 + name);
2002 while (!reader.hasError()) {
2003 switch (reader.readNext()) {
2004 case QXmlStreamReader::StartElement : {
2005 const auto tag = reader.name();
2006 if (!tag.compare(u"property"_s, Qt::CaseInsensitive)) {
2007 auto *v =
new DomProperty();
2009 m_property.append(v);
2012 if (!tag.compare(u"item"_s, Qt::CaseInsensitive)) {
2013 auto *v =
new DomItem();
2018 reader.raiseError(
"Unexpected element "_L1 + tag);
2021 case QXmlStreamReader::EndElement :
2029void DomItem::write(QXmlStreamWriter &writer,
const QString &tagName)
const
2031 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"item") : tagName.toLower());
2033 if (hasAttributeRow())
2034 writer.writeAttribute(u"row"_s, QString::number(attributeRow()));
2036 if (hasAttributeColumn())
2037 writer.writeAttribute(u"column"_s, QString::number(attributeColumn()));
2039 for (DomProperty *v : m_property)
2040 v->write(writer, u"property"_s);
2042 for (DomItem *v : m_item)
2043 v->write(writer, u"item"_s);
2045 writer.writeEndElement();
2048void DomItem::setElementProperty(
const QList<DomProperty *> &a)
2050 m_children |= Property;
2054void DomItem::setElementItem(
const QList<DomItem *> &a)
2060DomWidget::~DomWidget()
2063 qDeleteAll(m_property);
2065 qDeleteAll(m_attribute);
2066 m_attribute.clear();
2069 qDeleteAll(m_column);
2073 qDeleteAll(m_layout);
2075 qDeleteAll(m_widget);
2077 qDeleteAll(m_action);
2079 qDeleteAll(m_actionGroup);
2080 m_actionGroup.clear();
2081 qDeleteAll(m_addAction);
2082 m_addAction.clear();
2086void DomWidget::read(QXmlStreamReader &reader)
2088 const QXmlStreamAttributes &attributes = reader.attributes();
2089 for (
const QXmlStreamAttribute &attribute : attributes) {
2090 const auto name = attribute.name();
2091 if (name == u"class"_s) {
2092 setAttributeClass(attribute.value().toString());
2095 if (name == u"name"_s) {
2096 setAttributeName(attribute.value().toString());
2099 if (name == u"native"_s) {
2100 setAttributeNative(attribute.value() == u"true"_s);
2103 reader.raiseError(
"Unexpected attribute "_L1 + name);
2106 while (!reader.hasError()) {
2107 switch (reader.readNext()) {
2108 case QXmlStreamReader::StartElement : {
2109 const auto tag = reader.name();
2110 if (!tag.compare(u"class"_s, Qt::CaseInsensitive)) {
2111 m_class.append(reader.readElementText());
2114 if (!tag.compare(u"property"_s, Qt::CaseInsensitive)) {
2115 auto *v =
new DomProperty();
2117 m_property.append(v);
2120 if (!tag.compare(u"script"_s, Qt::CaseInsensitive)) {
2121 qWarning(
"Omitting deprecated element <script>.");
2122 reader.skipCurrentElement();
2125 if (!tag.compare(u"widgetdata"_s, Qt::CaseInsensitive)) {
2126 qWarning(
"Omitting deprecated element <widgetdata>.");
2127 reader.skipCurrentElement();
2130 if (!tag.compare(u"attribute"_s, Qt::CaseInsensitive)) {
2131 auto *v =
new DomProperty();
2133 m_attribute.append(v);
2136 if (!tag.compare(u"row"_s, Qt::CaseInsensitive)) {
2137 auto *v =
new DomRow();
2142 if (!tag.compare(u"column"_s, Qt::CaseInsensitive)) {
2143 auto *v =
new DomColumn();
2148 if (!tag.compare(u"item"_s, Qt::CaseInsensitive)) {
2149 auto *v =
new DomItem();
2154 if (!tag.compare(u"layout"_s, Qt::CaseInsensitive)) {
2155 auto *v =
new DomLayout();
2160 if (!tag.compare(u"widget"_s, Qt::CaseInsensitive)) {
2161 auto *v =
new DomWidget();
2166 if (!tag.compare(u"action"_s, Qt::CaseInsensitive)) {
2167 auto *v =
new DomAction();
2172 if (!tag.compare(u"actiongroup"_s, Qt::CaseInsensitive)) {
2173 auto *v =
new DomActionGroup();
2175 m_actionGroup.append(v);
2178 if (!tag.compare(u"addaction"_s, Qt::CaseInsensitive)) {
2179 auto *v =
new DomActionRef();
2181 m_addAction.append(v);
2184 if (!tag.compare(u"zorder"_s, Qt::CaseInsensitive)) {
2185 m_zOrder.append(reader.readElementText());
2188 reader.raiseError(
"Unexpected element "_L1 + tag);
2191 case QXmlStreamReader::EndElement :
2199void DomWidget::write(QXmlStreamWriter &writer,
const QString &tagName)
const
2201 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"widget") : tagName.toLower());
2203 if (hasAttributeClass())
2204 writer.writeAttribute(u"class"_s, attributeClass());
2206 if (hasAttributeName())
2207 writer.writeAttribute(u"name"_s, attributeName());
2209 if (hasAttributeNative())
2210 writer.writeAttribute(u"native"_s, (attributeNative() ? u"true"_s : u"false"_s));
2212 for (
const QString &v : m_class)
2213 writer.writeTextElement(u"class"_s, v);
2215 for (DomProperty *v : m_property)
2216 v->write(writer, u"property"_s);
2218 for (DomProperty *v : m_attribute)
2219 v->write(writer, u"attribute"_s);
2221 for (DomRow *v : m_row)
2222 v->write(writer, u"row"_s);
2224 for (DomColumn *v : m_column)
2225 v->write(writer, u"column"_s);
2227 for (DomItem *v : m_item)
2228 v->write(writer, u"item"_s);
2230 for (DomLayout *v : m_layout)
2231 v->write(writer, u"layout"_s);
2233 for (DomWidget *v : m_widget)
2234 v->write(writer, u"widget"_s);
2236 for (DomAction *v : m_action)
2237 v->write(writer, u"action"_s);
2239 for (DomActionGroup *v : m_actionGroup)
2240 v->write(writer, u"actiongroup"_s);
2242 for (DomActionRef *v : m_addAction)
2243 v->write(writer, u"addaction"_s);
2245 for (
const QString &v : m_zOrder)
2246 writer.writeTextElement(u"zorder"_s, v);
2248 writer.writeEndElement();
2251void DomWidget::setElementClass(
const QStringList &a)
2253 m_children |= Class;
2257void DomWidget::setElementProperty(
const QList<DomProperty *> &a)
2259 m_children |= Property;
2263void DomWidget::setElementAttribute(
const QList<DomProperty *> &a)
2265 m_children |= Attribute;
2269void DomWidget::setElementRow(
const QList<DomRow *> &a)
2275void DomWidget::setElementColumn(
const QList<DomColumn *> &a)
2277 m_children |= Column;
2281void DomWidget::setElementItem(
const QList<DomItem *> &a)
2287void DomWidget::setElementLayout(
const QList<DomLayout *> &a)
2289 m_children |= Layout;
2293void DomWidget::setElementWidget(
const QList<DomWidget *> &a)
2295 m_children |= Widget;
2299void DomWidget::setElementAction(
const QList<DomAction *> &a)
2301 m_children |= Action;
2305void DomWidget::setElementActionGroup(
const QList<DomActionGroup *> &a)
2307 m_children |= ActionGroup;
2311void DomWidget::setElementAddAction(
const QList<DomActionRef *> &a)
2313 m_children |= AddAction;
2317void DomWidget::setElementZOrder(
const QStringList &a)
2319 m_children |= ZOrder;
2323DomSpacer::~DomSpacer()
2325 qDeleteAll(m_property);
2329void DomSpacer::read(QXmlStreamReader &reader)
2331 const QXmlStreamAttributes &attributes = reader.attributes();
2332 for (
const QXmlStreamAttribute &attribute : attributes) {
2333 const auto name = attribute.name();
2334 if (name == u"name"_s) {
2335 setAttributeName(attribute.value().toString());
2338 reader.raiseError(
"Unexpected attribute "_L1 + name);
2341 while (!reader.hasError()) {
2342 switch (reader.readNext()) {
2343 case QXmlStreamReader::StartElement : {
2344 const auto tag = reader.name();
2345 if (!tag.compare(u"property"_s, Qt::CaseInsensitive)) {
2346 auto *v =
new DomProperty();
2348 m_property.append(v);
2351 reader.raiseError(
"Unexpected element "_L1 + tag);
2354 case QXmlStreamReader::EndElement :
2362void DomSpacer::write(QXmlStreamWriter &writer,
const QString &tagName)
const
2364 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"spacer") : tagName.toLower());
2366 if (hasAttributeName())
2367 writer.writeAttribute(u"name"_s, attributeName());
2369 for (DomProperty *v : m_property)
2370 v->write(writer, u"property"_s);
2372 writer.writeEndElement();
2375void DomSpacer::setElementProperty(
const QList<DomProperty *> &a)
2377 m_children |= Property;
2381DomColor::~DomColor() =
default;
2383void DomColor::read(QXmlStreamReader &reader)
2385 const QXmlStreamAttributes &attributes = reader.attributes();
2386 for (
const QXmlStreamAttribute &attribute : attributes) {
2387 const auto name = attribute.name();
2388 if (name == u"alpha"_s) {
2389 setAttributeAlpha(attribute.value().toInt());
2392 reader.raiseError(
"Unexpected attribute "_L1 + name);
2395 while (!reader.hasError()) {
2396 switch (reader.readNext()) {
2397 case QXmlStreamReader::StartElement : {
2398 const auto tag = reader.name();
2399 if (!tag.compare(u"red"_s, Qt::CaseInsensitive)) {
2400 setElementRed(reader.readElementText().toInt());
2403 if (!tag.compare(u"green"_s, Qt::CaseInsensitive)) {
2404 setElementGreen(reader.readElementText().toInt());
2407 if (!tag.compare(u"blue"_s, Qt::CaseInsensitive)) {
2408 setElementBlue(reader.readElementText().toInt());
2411 reader.raiseError(
"Unexpected element "_L1 + tag);
2414 case QXmlStreamReader::EndElement :
2422void DomColor::write(QXmlStreamWriter &writer,
const QString &tagName)
const
2424 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"color") : tagName.toLower());
2426 if (hasAttributeAlpha())
2427 writer.writeAttribute(u"alpha"_s, QString::number(attributeAlpha()));
2429 if (m_children & Red)
2430 writer.writeTextElement(u"red"_s, QString::number(m_red));
2432 if (m_children & Green)
2433 writer.writeTextElement(u"green"_s, QString::number(m_green));
2435 if (m_children & Blue)
2436 writer.writeTextElement(u"blue"_s, QString::number(m_blue));
2438 writer.writeEndElement();
2441void DomColor::setElementRed(
int a)
2447void DomColor::setElementGreen(
int a)
2449 m_children |= Green;
2453void DomColor::setElementBlue(
int a)
2459void DomColor::clearElementRed()
2464void DomColor::clearElementGreen()
2466 m_children &= ~Green;
2469void DomColor::clearElementBlue()
2471 m_children &= ~Blue;
2474DomGradientStop::~DomGradientStop()
2479void DomGradientStop::read(QXmlStreamReader &reader)
2481 const QXmlStreamAttributes &attributes = reader.attributes();
2482 for (
const QXmlStreamAttribute &attribute : attributes) {
2483 const auto name = attribute.name();
2484 if (name == u"position"_s) {
2485 setAttributePosition(attribute.value().toDouble());
2488 reader.raiseError(
"Unexpected attribute "_L1 + name);
2491 while (!reader.hasError()) {
2492 switch (reader.readNext()) {
2493 case QXmlStreamReader::StartElement : {
2494 const auto tag = reader.name();
2495 if (!tag.compare(u"color"_s, Qt::CaseInsensitive)) {
2496 auto *v =
new DomColor();
2501 reader.raiseError(
"Unexpected element "_L1 + tag);
2504 case QXmlStreamReader::EndElement :
2512void DomGradientStop::write(QXmlStreamWriter &writer,
const QString &tagName)
const
2514 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"gradientstop") : tagName.toLower());
2516 if (hasAttributePosition())
2517 writer.writeAttribute(u"position"_s, QString::number(attributePosition(),
'f', 15));
2519 if (m_children & Color)
2520 m_color->write(writer, u"color"_s);
2522 writer.writeEndElement();
2525DomColor *DomGradientStop::takeElementColor()
2527 DomColor *a = m_color;
2529 m_children ^= Color;
2533void DomGradientStop::setElementColor(DomColor *a)
2536 m_children |= Color;
2540void DomGradientStop::clearElementColor()
2544 m_children &= ~Color;
2547DomGradient::~DomGradient()
2549 qDeleteAll(m_gradientStop);
2550 m_gradientStop.clear();
2553void DomGradient::read(QXmlStreamReader &reader)
2555 const QXmlStreamAttributes &attributes = reader.attributes();
2556 for (
const QXmlStreamAttribute &attribute : attributes) {
2557 const auto name = attribute.name();
2558 if (name == u"startx"_s) {
2559 setAttributeStartX(attribute.value().toDouble());
2562 if (name == u"starty"_s) {
2563 setAttributeStartY(attribute.value().toDouble());
2566 if (name == u"endx"_s) {
2567 setAttributeEndX(attribute.value().toDouble());
2570 if (name == u"endy"_s) {
2571 setAttributeEndY(attribute.value().toDouble());
2574 if (name == u"centralx"_s) {
2575 setAttributeCentralX(attribute.value().toDouble());
2578 if (name == u"centraly"_s) {
2579 setAttributeCentralY(attribute.value().toDouble());
2582 if (name == u"focalx"_s) {
2583 setAttributeFocalX(attribute.value().toDouble());
2586 if (name == u"focaly"_s) {
2587 setAttributeFocalY(attribute.value().toDouble());
2590 if (name == u"radius"_s) {
2591 setAttributeRadius(attribute.value().toDouble());
2594 if (name == u"angle"_s) {
2595 setAttributeAngle(attribute.value().toDouble());
2598 if (name == u"type"_s) {
2599 setAttributeType(attribute.value().toString());
2602 if (name == u"spread"_s) {
2603 setAttributeSpread(attribute.value().toString());
2606 if (name == u"coordinatemode"_s) {
2607 setAttributeCoordinateMode(attribute.value().toString());
2610 reader.raiseError(
"Unexpected attribute "_L1 + name);
2613 while (!reader.hasError()) {
2614 switch (reader.readNext()) {
2615 case QXmlStreamReader::StartElement : {
2616 const auto tag = reader.name();
2617 if (!tag.compare(u"gradientstop"_s, Qt::CaseInsensitive)) {
2618 auto *v =
new DomGradientStop();
2620 m_gradientStop.append(v);
2623 reader.raiseError(
"Unexpected element "_L1 + tag);
2626 case QXmlStreamReader::EndElement :
2634void DomGradient::write(QXmlStreamWriter &writer,
const QString &tagName)
const
2636 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"gradient") : tagName.toLower());
2638 if (hasAttributeStartX())
2639 writer.writeAttribute(u"startx"_s, QString::number(attributeStartX(),
'f', 15));
2641 if (hasAttributeStartY())
2642 writer.writeAttribute(u"starty"_s, QString::number(attributeStartY(),
'f', 15));
2644 if (hasAttributeEndX())
2645 writer.writeAttribute(u"endx"_s, QString::number(attributeEndX(),
'f', 15));
2647 if (hasAttributeEndY())
2648 writer.writeAttribute(u"endy"_s, QString::number(attributeEndY(),
'f', 15));
2650 if (hasAttributeCentralX())
2651 writer.writeAttribute(u"centralx"_s, QString::number(attributeCentralX(),
'f', 15));
2653 if (hasAttributeCentralY())
2654 writer.writeAttribute(u"centraly"_s, QString::number(attributeCentralY(),
'f', 15));
2656 if (hasAttributeFocalX())
2657 writer.writeAttribute(u"focalx"_s, QString::number(attributeFocalX(),
'f', 15));
2659 if (hasAttributeFocalY())
2660 writer.writeAttribute(u"focaly"_s, QString::number(attributeFocalY(),
'f', 15));
2662 if (hasAttributeRadius())
2663 writer.writeAttribute(u"radius"_s, QString::number(attributeRadius(),
'f', 15));
2665 if (hasAttributeAngle())
2666 writer.writeAttribute(u"angle"_s, QString::number(attributeAngle(),
'f', 15));
2668 if (hasAttributeType())
2669 writer.writeAttribute(u"type"_s, attributeType());
2671 if (hasAttributeSpread())
2672 writer.writeAttribute(u"spread"_s, attributeSpread());
2674 if (hasAttributeCoordinateMode())
2675 writer.writeAttribute(u"coordinatemode"_s, attributeCoordinateMode());
2677 for (DomGradientStop *v : m_gradientStop)
2678 v->write(writer, u"gradientstop"_s);
2680 writer.writeEndElement();
2683void DomGradient::setElementGradientStop(
const QList<DomGradientStop *> &a)
2685 m_children |= GradientStop;
2689DomBrush::~DomBrush()
2696void DomBrush::clear()
2705 m_texture =
nullptr;
2706 m_gradient =
nullptr;
2709void DomBrush::read(QXmlStreamReader &reader)
2711 const QXmlStreamAttributes &attributes = reader.attributes();
2712 for (
const QXmlStreamAttribute &attribute : attributes) {
2713 const auto name = attribute.name();
2714 if (name == u"brushstyle"_s) {
2715 setAttributeBrushStyle(attribute.value().toString());
2718 reader.raiseError(
"Unexpected attribute "_L1 + name);
2721 while (!reader.hasError()) {
2722 switch (reader.readNext()) {
2723 case QXmlStreamReader::StartElement : {
2724 const auto tag = reader.name();
2725 if (!tag.compare(u"color"_s, Qt::CaseInsensitive)) {
2726 auto *v =
new DomColor();
2731 if (!tag.compare(u"texture"_s, Qt::CaseInsensitive)) {
2732 auto *v =
new DomProperty();
2734 setElementTexture(v);
2737 if (!tag.compare(u"gradient"_s, Qt::CaseInsensitive)) {
2738 auto *v =
new DomGradient();
2740 setElementGradient(v);
2743 reader.raiseError(
"Unexpected element "_L1 + tag);
2746 case QXmlStreamReader::EndElement :
2754void DomBrush::write(QXmlStreamWriter &writer,
const QString &tagName)
const
2756 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"brush") : tagName.toLower());
2758 if (hasAttributeBrushStyle())
2759 writer.writeAttribute(u"brushstyle"_s, attributeBrushStyle());
2763 if (m_color !=
nullptr)
2764 m_color->write(writer, u"color"_s);
2768 if (m_texture !=
nullptr)
2769 m_texture->write(writer, u"texture"_s);
2773 if (m_gradient !=
nullptr)
2774 m_gradient->write(writer, u"gradient"_s);
2780 writer.writeEndElement();
2783DomColor *DomBrush::takeElementColor()
2785 DomColor *a = m_color;
2790void DomBrush::setElementColor(DomColor *a)
2797DomProperty *DomBrush::takeElementTexture()
2799 DomProperty *a = m_texture;
2800 m_texture =
nullptr;
2804void DomBrush::setElementTexture(DomProperty *a)
2811DomGradient *DomBrush::takeElementGradient()
2813 DomGradient *a = m_gradient;
2814 m_gradient =
nullptr;
2818void DomBrush::setElementGradient(DomGradient *a)
2825DomColorRole::~DomColorRole()
2830void DomColorRole::read(QXmlStreamReader &reader)
2832 const QXmlStreamAttributes &attributes = reader.attributes();
2833 for (
const QXmlStreamAttribute &attribute : attributes) {
2834 const auto name = attribute.name();
2835 if (name == u"role"_s) {
2836 setAttributeRole(attribute.value().toString());
2839 reader.raiseError(
"Unexpected attribute "_L1 + name);
2842 while (!reader.hasError()) {
2843 switch (reader.readNext()) {
2844 case QXmlStreamReader::StartElement : {
2845 const auto tag = reader.name();
2846 if (!tag.compare(u"brush"_s, Qt::CaseInsensitive)) {
2847 auto *v =
new DomBrush();
2852 reader.raiseError(
"Unexpected element "_L1 + tag);
2855 case QXmlStreamReader::EndElement :
2863void DomColorRole::write(QXmlStreamWriter &writer,
const QString &tagName)
const
2865 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"colorrole") : tagName.toLower());
2867 if (hasAttributeRole())
2868 writer.writeAttribute(u"role"_s, attributeRole());
2870 if (m_children & Brush)
2871 m_brush->write(writer, u"brush"_s);
2873 writer.writeEndElement();
2876DomBrush *DomColorRole::takeElementBrush()
2878 DomBrush *a = m_brush;
2880 m_children ^= Brush;
2884void DomColorRole::setElementBrush(DomBrush *a)
2887 m_children |= Brush;
2891void DomColorRole::clearElementBrush()
2895 m_children &= ~Brush;
2898DomColorGroup::~DomColorGroup()
2900 qDeleteAll(m_colorRole);
2901 m_colorRole.clear();
2902 qDeleteAll(m_color);
2906void DomColorGroup::read(QXmlStreamReader &reader)
2908 while (!reader.hasError()) {
2909 switch (reader.readNext()) {
2910 case QXmlStreamReader::StartElement : {
2911 const auto tag = reader.name();
2912 if (!tag.compare(u"colorrole"_s, Qt::CaseInsensitive)) {
2913 auto *v =
new DomColorRole();
2915 m_colorRole.append(v);
2918 if (!tag.compare(u"color"_s, Qt::CaseInsensitive)) {
2919 auto *v =
new DomColor();
2924 reader.raiseError(
"Unexpected element "_L1 + tag);
2927 case QXmlStreamReader::EndElement :
2935void DomColorGroup::write(QXmlStreamWriter &writer,
const QString &tagName)
const
2937 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"colorgroup") : tagName.toLower());
2939 for (DomColorRole *v : m_colorRole)
2940 v->write(writer, u"colorrole"_s);
2942 for (DomColor *v : m_color)
2943 v->write(writer, u"color"_s);
2945 writer.writeEndElement();
2948void DomColorGroup::setElementColorRole(
const QList<DomColorRole *> &a)
2950 m_children |= ColorRole;
2954void DomColorGroup::setElementColor(
const QList<DomColor *> &a)
2956 m_children |= Color;
2960DomPalette::~DomPalette()
2967void DomPalette::read(QXmlStreamReader &reader)
2969 while (!reader.hasError()) {
2970 switch (reader.readNext()) {
2971 case QXmlStreamReader::StartElement : {
2972 const auto tag = reader.name();
2973 if (!tag.compare(u"active"_s, Qt::CaseInsensitive)) {
2974 auto *v =
new DomColorGroup();
2976 setElementActive(v);
2979 if (!tag.compare(u"inactive"_s, Qt::CaseInsensitive)) {
2980 auto *v =
new DomColorGroup();
2982 setElementInactive(v);
2985 if (!tag.compare(u"disabled"_s, Qt::CaseInsensitive)) {
2986 auto *v =
new DomColorGroup();
2988 setElementDisabled(v);
2991 reader.raiseError(
"Unexpected element "_L1 + tag);
2994 case QXmlStreamReader::EndElement :
3002void DomPalette::write(QXmlStreamWriter &writer,
const QString &tagName)
const
3004 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"palette") : tagName.toLower());
3006 if (m_children & Active)
3007 m_active->write(writer, u"active"_s);
3009 if (m_children & Inactive)
3010 m_inactive->write(writer, u"inactive"_s);
3012 if (m_children & Disabled)
3013 m_disabled->write(writer, u"disabled"_s);
3015 writer.writeEndElement();
3018DomColorGroup *DomPalette::takeElementActive()
3020 DomColorGroup *a = m_active;
3022 m_children ^= Active;
3026void DomPalette::setElementActive(DomColorGroup *a)
3029 m_children |= Active;
3033DomColorGroup *DomPalette::takeElementInactive()
3035 DomColorGroup *a = m_inactive;
3036 m_inactive =
nullptr;
3037 m_children ^= Inactive;
3041void DomPalette::setElementInactive(DomColorGroup *a)
3044 m_children |= Inactive;
3048DomColorGroup *DomPalette::takeElementDisabled()
3050 DomColorGroup *a = m_disabled;
3051 m_disabled =
nullptr;
3052 m_children ^= Disabled;
3056void DomPalette::setElementDisabled(DomColorGroup *a)
3059 m_children |= Disabled;
3063void DomPalette::clearElementActive()
3067 m_children &= ~Active;
3070void DomPalette::clearElementInactive()
3073 m_inactive =
nullptr;
3074 m_children &= ~Inactive;
3077void DomPalette::clearElementDisabled()
3080 m_disabled =
nullptr;
3081 m_children &= ~Disabled;
3084DomFont::~DomFont() =
default;
3086void DomFont::read(QXmlStreamReader &reader)
3088 while (!reader.hasError()) {
3089 switch (reader.readNext()) {
3090 case QXmlStreamReader::StartElement : {
3091 const auto tag = reader.name();
3092 if (!tag.compare(u"family"_s, Qt::CaseInsensitive)) {
3093 setElementFamily(reader.readElementText());
3096 if (!tag.compare(u"pointsize"_s, Qt::CaseInsensitive)) {
3097 setElementPointSize(reader.readElementText().toInt());
3100 if (!tag.compare(u"weight"_s, Qt::CaseInsensitive)) {
3101 setElementWeight(reader.readElementText().toInt());
3104 if (!tag.compare(u"italic"_s, Qt::CaseInsensitive)) {
3105 setElementItalic(reader.readElementText() == u"true"_s);
3108 if (!tag.compare(u"bold"_s, Qt::CaseInsensitive)) {
3109 setElementBold(reader.readElementText() == u"true"_s);
3112 if (!tag.compare(u"underline"_s, Qt::CaseInsensitive)) {
3113 setElementUnderline(reader.readElementText() == u"true"_s);
3116 if (!tag.compare(u"strikeout"_s, Qt::CaseInsensitive)) {
3117 setElementStrikeOut(reader.readElementText() == u"true"_s);
3120 if (!tag.compare(u"antialiasing"_s, Qt::CaseInsensitive)) {
3121 setElementAntialiasing(reader.readElementText() == u"true"_s);
3124 if (!tag.compare(u"stylestrategy"_s, Qt::CaseInsensitive)) {
3125 setElementStyleStrategy(reader.readElementText());
3128 if (!tag.compare(u"kerning"_s, Qt::CaseInsensitive)) {
3129 setElementKerning(reader.readElementText() == u"true"_s);
3132 if (!tag.compare(u"hintingpreference"_s, Qt::CaseInsensitive)) {
3133 setElementHintingPreference(reader.readElementText());
3136 if (!tag.compare(u"fontweight"_s, Qt::CaseInsensitive)) {
3137 setElementFontWeight(reader.readElementText());
3140 reader.raiseError(
"Unexpected element "_L1 + tag);
3143 case QXmlStreamReader::EndElement :
3151void DomFont::write(QXmlStreamWriter &writer,
const QString &tagName)
const
3153 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"font") : tagName.toLower());
3155 if (m_children & Family)
3156 writer.writeTextElement(u"family"_s, m_family);
3158 if (m_children & PointSize)
3159 writer.writeTextElement(u"pointsize"_s, QString::number(m_pointSize));
3161 if (m_children & Weight)
3162 writer.writeTextElement(u"weight"_s, QString::number(m_weight));
3164 if (m_children & Italic)
3165 writer.writeTextElement(u"italic"_s, (m_italic ? u"true"_s : u"false"_s));
3167 if (m_children & Bold)
3168 writer.writeTextElement(u"bold"_s, (m_bold ? u"true"_s : u"false"_s));
3170 if (m_children & Underline)
3171 writer.writeTextElement(u"underline"_s, (m_underline ? u"true"_s : u"false"_s));
3173 if (m_children & StrikeOut)
3174 writer.writeTextElement(u"strikeout"_s, (m_strikeOut ? u"true"_s : u"false"_s));
3176 if (m_children & Antialiasing)
3177 writer.writeTextElement(u"antialiasing"_s, (m_antialiasing ? u"true"_s : u"false"_s));
3179 if (m_children & StyleStrategy)
3180 writer.writeTextElement(u"stylestrategy"_s, m_styleStrategy);
3182 if (m_children & Kerning)
3183 writer.writeTextElement(u"kerning"_s, (m_kerning ? u"true"_s : u"false"_s));
3185 if (m_children & HintingPreference)
3186 writer.writeTextElement(u"hintingpreference"_s, m_hintingPreference);
3188 if (m_children & FontWeight)
3189 writer.writeTextElement(u"fontweight"_s, m_fontWeight);
3191 writer.writeEndElement();
3194void DomFont::setElementFamily(
const QString &a)
3196 m_children |= Family;
3200void DomFont::setElementPointSize(
int a)
3202 m_children |= PointSize;
3206void DomFont::setElementWeight(
int a)
3208 m_children |= Weight;
3212void DomFont::setElementItalic(
bool a)
3214 m_children |= Italic;
3218void DomFont::setElementBold(
bool a)
3224void DomFont::setElementUnderline(
bool a)
3226 m_children |= Underline;
3230void DomFont::setElementStrikeOut(
bool a)
3232 m_children |= StrikeOut;
3236void DomFont::setElementAntialiasing(
bool a)
3238 m_children |= Antialiasing;
3242void DomFont::setElementStyleStrategy(
const QString &a)
3244 m_children |= StyleStrategy;
3245 m_styleStrategy = a;
3248void DomFont::setElementKerning(
bool a)
3250 m_children |= Kerning;
3254void DomFont::setElementHintingPreference(
const QString &a)
3256 m_children |= HintingPreference;
3257 m_hintingPreference = a;
3260void DomFont::setElementFontWeight(
const QString &a)
3262 m_children |= FontWeight;
3266void DomFont::clearElementFamily()
3268 m_children &= ~Family;
3271void DomFont::clearElementPointSize()
3273 m_children &= ~PointSize;
3276void DomFont::clearElementWeight()
3278 m_children &= ~Weight;
3281void DomFont::clearElementItalic()
3283 m_children &= ~Italic;
3286void DomFont::clearElementBold()
3288 m_children &= ~Bold;
3291void DomFont::clearElementUnderline()
3293 m_children &= ~Underline;
3296void DomFont::clearElementStrikeOut()
3298 m_children &= ~StrikeOut;
3301void DomFont::clearElementAntialiasing()
3303 m_children &= ~Antialiasing;
3306void DomFont::clearElementStyleStrategy()
3308 m_children &= ~StyleStrategy;
3311void DomFont::clearElementKerning()
3313 m_children &= ~Kerning;
3316void DomFont::clearElementHintingPreference()
3318 m_children &= ~HintingPreference;
3321void DomFont::clearElementFontWeight()
3323 m_children &= ~FontWeight;
3326DomPoint::~DomPoint() =
default;
3328void DomPoint::read(QXmlStreamReader &reader)
3330 while (!reader.hasError()) {
3331 switch (reader.readNext()) {
3332 case QXmlStreamReader::StartElement : {
3333 const auto tag = reader.name();
3334 if (!tag.compare(u"x"_s, Qt::CaseInsensitive)) {
3335 setElementX(reader.readElementText().toInt());
3338 if (!tag.compare(u"y"_s, Qt::CaseInsensitive)) {
3339 setElementY(reader.readElementText().toInt());
3342 reader.raiseError(
"Unexpected element "_L1 + tag);
3345 case QXmlStreamReader::EndElement :
3353void DomPoint::write(QXmlStreamWriter &writer,
const QString &tagName)
const
3355 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"point") : tagName.toLower());
3358 writer.writeTextElement(u"x"_s, QString::number(m_x));
3361 writer.writeTextElement(u"y"_s, QString::number(m_y));
3363 writer.writeEndElement();
3366void DomPoint::setElementX(
int a)
3372void DomPoint::setElementY(
int a)
3378void DomPoint::clearElementX()
3383void DomPoint::clearElementY()
3388DomRect::~DomRect() =
default;
3390void DomRect::read(QXmlStreamReader &reader)
3392 while (!reader.hasError()) {
3393 switch (reader.readNext()) {
3394 case QXmlStreamReader::StartElement : {
3395 const auto tag = reader.name();
3396 if (!tag.compare(u"x"_s, Qt::CaseInsensitive)) {
3397 setElementX(reader.readElementText().toInt());
3400 if (!tag.compare(u"y"_s, Qt::CaseInsensitive)) {
3401 setElementY(reader.readElementText().toInt());
3404 if (!tag.compare(u"width"_s, Qt::CaseInsensitive)) {
3405 setElementWidth(reader.readElementText().toInt());
3408 if (!tag.compare(u"height"_s, Qt::CaseInsensitive)) {
3409 setElementHeight(reader.readElementText().toInt());
3412 reader.raiseError(
"Unexpected element "_L1 + tag);
3415 case QXmlStreamReader::EndElement :
3423void DomRect::write(QXmlStreamWriter &writer,
const QString &tagName)
const
3425 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"rect") : tagName.toLower());
3428 writer.writeTextElement(u"x"_s, QString::number(m_x));
3431 writer.writeTextElement(u"y"_s, QString::number(m_y));
3433 if (m_children & Width)
3434 writer.writeTextElement(u"width"_s, QString::number(m_width));
3436 if (m_children & Height)
3437 writer.writeTextElement(u"height"_s, QString::number(m_height));
3439 writer.writeEndElement();
3442void DomRect::setElementX(
int a)
3448void DomRect::setElementY(
int a)
3454void DomRect::setElementWidth(
int a)
3456 m_children |= Width;
3460void DomRect::setElementHeight(
int a)
3462 m_children |= Height;
3466void DomRect::clearElementX()
3471void DomRect::clearElementY()
3476void DomRect::clearElementWidth()
3478 m_children &= ~Width;
3481void DomRect::clearElementHeight()
3483 m_children &= ~Height;
3486DomLocale::~DomLocale() =
default;
3488void DomLocale::read(QXmlStreamReader &reader)
3490 const QXmlStreamAttributes &attributes = reader.attributes();
3491 for (
const QXmlStreamAttribute &attribute : attributes) {
3492 const auto name = attribute.name();
3493 if (name == u"language"_s) {
3494 setAttributeLanguage(attribute.value().toString());
3497 if (name == u"country"_s) {
3498 setAttributeCountry(attribute.value().toString());
3501 reader.raiseError(
"Unexpected attribute "_L1 + name);
3504 while (!reader.hasError()) {
3505 switch (reader.readNext()) {
3506 case QXmlStreamReader::StartElement : {
3507 const auto tag = reader.name();
3508 reader.raiseError(
"Unexpected element "_L1 + tag);
3511 case QXmlStreamReader::EndElement :
3519void DomLocale::write(QXmlStreamWriter &writer,
const QString &tagName)
const
3521 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"locale") : tagName.toLower());
3523 if (hasAttributeLanguage())
3524 writer.writeAttribute(u"language"_s, attributeLanguage());
3526 if (hasAttributeCountry())
3527 writer.writeAttribute(u"country"_s, attributeCountry());
3529 writer.writeEndElement();
3532DomSizePolicy::~DomSizePolicy() =
default;
3534void DomSizePolicy::read(QXmlStreamReader &reader)
3536 const QXmlStreamAttributes &attributes = reader.attributes();
3537 for (
const QXmlStreamAttribute &attribute : attributes) {
3538 const auto name = attribute.name();
3539 if (name == u"hsizetype"_s) {
3540 setAttributeHSizeType(attribute.value().toString());
3543 if (name == u"vsizetype"_s) {
3544 setAttributeVSizeType(attribute.value().toString());
3547 reader.raiseError(
"Unexpected attribute "_L1 + name);
3550 while (!reader.hasError()) {
3551 switch (reader.readNext()) {
3552 case QXmlStreamReader::StartElement : {
3553 const auto tag = reader.name();
3554 if (!tag.compare(u"hsizetype"_s, Qt::CaseInsensitive)) {
3555 setElementHSizeType(reader.readElementText().toInt());
3558 if (!tag.compare(u"vsizetype"_s, Qt::CaseInsensitive)) {
3559 setElementVSizeType(reader.readElementText().toInt());
3562 if (!tag.compare(u"horstretch"_s, Qt::CaseInsensitive)) {
3563 setElementHorStretch(reader.readElementText().toInt());
3566 if (!tag.compare(u"verstretch"_s, Qt::CaseInsensitive)) {
3567 setElementVerStretch(reader.readElementText().toInt());
3570 reader.raiseError(
"Unexpected element "_L1 + tag);
3573 case QXmlStreamReader::EndElement :
3581void DomSizePolicy::write(QXmlStreamWriter &writer,
const QString &tagName)
const
3583 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"sizepolicy") : tagName.toLower());
3585 if (hasAttributeHSizeType())
3586 writer.writeAttribute(u"hsizetype"_s, attributeHSizeType());
3588 if (hasAttributeVSizeType())
3589 writer.writeAttribute(u"vsizetype"_s, attributeVSizeType());
3591 if (m_children & HSizeType)
3592 writer.writeTextElement(u"hsizetype"_s, QString::number(m_hSizeType));
3594 if (m_children & VSizeType)
3595 writer.writeTextElement(u"vsizetype"_s, QString::number(m_vSizeType));
3597 if (m_children & HorStretch)
3598 writer.writeTextElement(u"horstretch"_s, QString::number(m_horStretch));
3600 if (m_children & VerStretch)
3601 writer.writeTextElement(u"verstretch"_s, QString::number(m_verStretch));
3603 writer.writeEndElement();
3606void DomSizePolicy::setElementHSizeType(
int a)
3608 m_children |= HSizeType;
3612void DomSizePolicy::setElementVSizeType(
int a)
3614 m_children |= VSizeType;
3618void DomSizePolicy::setElementHorStretch(
int a)
3620 m_children |= HorStretch;
3624void DomSizePolicy::setElementVerStretch(
int a)
3626 m_children |= VerStretch;
3630void DomSizePolicy::clearElementHSizeType()
3632 m_children &= ~HSizeType;
3635void DomSizePolicy::clearElementVSizeType()
3637 m_children &= ~VSizeType;
3640void DomSizePolicy::clearElementHorStretch()
3642 m_children &= ~HorStretch;
3645void DomSizePolicy::clearElementVerStretch()
3647 m_children &= ~VerStretch;
3650DomSize::~DomSize() =
default;
3652void DomSize::read(QXmlStreamReader &reader)
3654 while (!reader.hasError()) {
3655 switch (reader.readNext()) {
3656 case QXmlStreamReader::StartElement : {
3657 const auto tag = reader.name();
3658 if (!tag.compare(u"width"_s, Qt::CaseInsensitive)) {
3659 setElementWidth(reader.readElementText().toInt());
3662 if (!tag.compare(u"height"_s, Qt::CaseInsensitive)) {
3663 setElementHeight(reader.readElementText().toInt());
3666 reader.raiseError(
"Unexpected element "_L1 + tag);
3669 case QXmlStreamReader::EndElement :
3677void DomSize::write(QXmlStreamWriter &writer,
const QString &tagName)
const
3679 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"size") : tagName.toLower());
3681 if (m_children & Width)
3682 writer.writeTextElement(u"width"_s, QString::number(m_width));
3684 if (m_children & Height)
3685 writer.writeTextElement(u"height"_s, QString::number(m_height));
3687 writer.writeEndElement();
3690void DomSize::setElementWidth(
int a)
3692 m_children |= Width;
3696void DomSize::setElementHeight(
int a)
3698 m_children |= Height;
3702void DomSize::clearElementWidth()
3704 m_children &= ~Width;
3707void DomSize::clearElementHeight()
3709 m_children &= ~Height;
3712DomDate::~DomDate() =
default;
3714void DomDate::read(QXmlStreamReader &reader)
3716 while (!reader.hasError()) {
3717 switch (reader.readNext()) {
3718 case QXmlStreamReader::StartElement : {
3719 const auto tag = reader.name();
3720 if (!tag.compare(u"year"_s, Qt::CaseInsensitive)) {
3721 setElementYear(reader.readElementText().toInt());
3724 if (!tag.compare(u"month"_s, Qt::CaseInsensitive)) {
3725 setElementMonth(reader.readElementText().toInt());
3728 if (!tag.compare(u"day"_s, Qt::CaseInsensitive)) {
3729 setElementDay(reader.readElementText().toInt());
3732 reader.raiseError(
"Unexpected element "_L1 + tag);
3735 case QXmlStreamReader::EndElement :
3743void DomDate::write(QXmlStreamWriter &writer,
const QString &tagName)
const
3745 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"date") : tagName.toLower());
3747 if (m_children & Year)
3748 writer.writeTextElement(u"year"_s, QString::number(m_year));
3750 if (m_children & Month)
3751 writer.writeTextElement(u"month"_s, QString::number(m_month));
3753 if (m_children & Day)
3754 writer.writeTextElement(u"day"_s, QString::number(m_day));
3756 writer.writeEndElement();
3759void DomDate::setElementYear(
int a)
3765void DomDate::setElementMonth(
int a)
3767 m_children |= Month;
3771void DomDate::setElementDay(
int a)
3777void DomDate::clearElementYear()
3779 m_children &= ~Year;
3782void DomDate::clearElementMonth()
3784 m_children &= ~Month;
3787void DomDate::clearElementDay()
3792DomTime::~DomTime() =
default;
3794void DomTime::read(QXmlStreamReader &reader)
3796 while (!reader.hasError()) {
3797 switch (reader.readNext()) {
3798 case QXmlStreamReader::StartElement : {
3799 const auto tag = reader.name();
3800 if (!tag.compare(u"hour"_s, Qt::CaseInsensitive)) {
3801 setElementHour(reader.readElementText().toInt());
3804 if (!tag.compare(u"minute"_s, Qt::CaseInsensitive)) {
3805 setElementMinute(reader.readElementText().toInt());
3808 if (!tag.compare(u"second"_s, Qt::CaseInsensitive)) {
3809 setElementSecond(reader.readElementText().toInt());
3812 reader.raiseError(
"Unexpected element "_L1 + tag);
3815 case QXmlStreamReader::EndElement :
3823void DomTime::write(QXmlStreamWriter &writer,
const QString &tagName)
const
3825 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"time") : tagName.toLower());
3827 if (m_children & Hour)
3828 writer.writeTextElement(u"hour"_s, QString::number(m_hour));
3830 if (m_children & Minute)
3831 writer.writeTextElement(u"minute"_s, QString::number(m_minute));
3833 if (m_children & Second)
3834 writer.writeTextElement(u"second"_s, QString::number(m_second));
3836 writer.writeEndElement();
3839void DomTime::setElementHour(
int a)
3845void DomTime::setElementMinute(
int a)
3847 m_children |= Minute;
3851void DomTime::setElementSecond(
int a)
3853 m_children |= Second;
3857void DomTime::clearElementHour()
3859 m_children &= ~Hour;
3862void DomTime::clearElementMinute()
3864 m_children &= ~Minute;
3867void DomTime::clearElementSecond()
3869 m_children &= ~Second;
3872DomDateTime::~DomDateTime() =
default;
3874void DomDateTime::read(QXmlStreamReader &reader)
3876 while (!reader.hasError()) {
3877 switch (reader.readNext()) {
3878 case QXmlStreamReader::StartElement : {
3879 const auto tag = reader.name();
3880 if (!tag.compare(u"hour"_s, Qt::CaseInsensitive)) {
3881 setElementHour(reader.readElementText().toInt());
3884 if (!tag.compare(u"minute"_s, Qt::CaseInsensitive)) {
3885 setElementMinute(reader.readElementText().toInt());
3888 if (!tag.compare(u"second"_s, Qt::CaseInsensitive)) {
3889 setElementSecond(reader.readElementText().toInt());
3892 if (!tag.compare(u"year"_s, Qt::CaseInsensitive)) {
3893 setElementYear(reader.readElementText().toInt());
3896 if (!tag.compare(u"month"_s, Qt::CaseInsensitive)) {
3897 setElementMonth(reader.readElementText().toInt());
3900 if (!tag.compare(u"day"_s, Qt::CaseInsensitive)) {
3901 setElementDay(reader.readElementText().toInt());
3904 reader.raiseError(
"Unexpected element "_L1 + tag);
3907 case QXmlStreamReader::EndElement :
3915void DomDateTime::write(QXmlStreamWriter &writer,
const QString &tagName)
const
3917 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"datetime") : tagName.toLower());
3919 if (m_children & Hour)
3920 writer.writeTextElement(u"hour"_s, QString::number(m_hour));
3922 if (m_children & Minute)
3923 writer.writeTextElement(u"minute"_s, QString::number(m_minute));
3925 if (m_children & Second)
3926 writer.writeTextElement(u"second"_s, QString::number(m_second));
3928 if (m_children & Year)
3929 writer.writeTextElement(u"year"_s, QString::number(m_year));
3931 if (m_children & Month)
3932 writer.writeTextElement(u"month"_s, QString::number(m_month));
3934 if (m_children & Day)
3935 writer.writeTextElement(u"day"_s, QString::number(m_day));
3937 writer.writeEndElement();
3940void DomDateTime::setElementHour(
int a)
3946void DomDateTime::setElementMinute(
int a)
3948 m_children |= Minute;
3952void DomDateTime::setElementSecond(
int a)
3954 m_children |= Second;
3958void DomDateTime::setElementYear(
int a)
3964void DomDateTime::setElementMonth(
int a)
3966 m_children |= Month;
3970void DomDateTime::setElementDay(
int a)
3976void DomDateTime::clearElementHour()
3978 m_children &= ~Hour;
3981void DomDateTime::clearElementMinute()
3983 m_children &= ~Minute;
3986void DomDateTime::clearElementSecond()
3988 m_children &= ~Second;
3991void DomDateTime::clearElementYear()
3993 m_children &= ~Year;
3996void DomDateTime::clearElementMonth()
3998 m_children &= ~Month;
4001void DomDateTime::clearElementDay()
4006DomStringList::~DomStringList()
4011void DomStringList::read(QXmlStreamReader &reader)
4013 const QXmlStreamAttributes &attributes = reader.attributes();
4014 for (
const QXmlStreamAttribute &attribute : attributes) {
4015 const auto name = attribute.name();
4016 if (name == u"notr"_s) {
4017 setAttributeNotr(attribute.value().toString());
4020 if (name == u"comment"_s) {
4021 setAttributeComment(attribute.value().toString());
4024 if (name == u"extracomment"_s) {
4025 setAttributeExtraComment(attribute.value().toString());
4028 if (name == u"id"_s) {
4029 setAttributeId(attribute.value().toString());
4032 reader.raiseError(
"Unexpected attribute "_L1 + name);
4035 while (!reader.hasError()) {
4036 switch (reader.readNext()) {
4037 case QXmlStreamReader::StartElement : {
4038 const auto tag = reader.name();
4039 if (!tag.compare(u"string"_s, Qt::CaseInsensitive)) {
4040 m_string.append(reader.readElementText());
4043 reader.raiseError(
"Unexpected element "_L1 + tag);
4046 case QXmlStreamReader::EndElement :
4054void DomStringList::write(QXmlStreamWriter &writer,
const QString &tagName)
const
4056 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"stringlist") : tagName.toLower());
4058 if (hasAttributeNotr())
4059 writer.writeAttribute(u"notr"_s, attributeNotr());
4061 if (hasAttributeComment())
4062 writer.writeAttribute(u"comment"_s, attributeComment());
4064 if (hasAttributeExtraComment())
4065 writer.writeAttribute(u"extracomment"_s, attributeExtraComment());
4067 if (hasAttributeId())
4068 writer.writeAttribute(u"id"_s, attributeId());
4070 for (
const QString &v : m_string)
4071 writer.writeTextElement(u"string"_s, v);
4073 writer.writeEndElement();
4076void DomStringList::setElementString(
const QStringList &a)
4078 m_children |= String;
4082DomResourcePixmap::~DomResourcePixmap() =
default;
4084void DomResourcePixmap::read(QXmlStreamReader &reader)
4086 const QXmlStreamAttributes &attributes = reader.attributes();
4087 for (
const QXmlStreamAttribute &attribute : attributes) {
4088 const auto name = attribute.name();
4089 if (name == u"resource"_s) {
4090 setAttributeResource(attribute.value().toString());
4093 if (name == u"alias"_s) {
4094 setAttributeAlias(attribute.value().toString());
4097 reader.raiseError(
"Unexpected attribute "_L1 + name);
4100 while (!reader.hasError()) {
4101 switch (reader.readNext()) {
4102 case QXmlStreamReader::StartElement : {
4103 const auto tag = reader.name();
4104 reader.raiseError(
"Unexpected element "_L1 + tag);
4107 case QXmlStreamReader::EndElement :
4109 case QXmlStreamReader::Characters :
4110 if (!reader.isWhitespace())
4111 m_text.append(reader.text().toString());
4119void DomResourcePixmap::write(QXmlStreamWriter &writer,
const QString &tagName)
const
4121 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"resourcepixmap") : tagName.toLower());
4123 if (hasAttributeResource())
4124 writer.writeAttribute(u"resource"_s, attributeResource());
4126 if (hasAttributeAlias())
4127 writer.writeAttribute(u"alias"_s, attributeAlias());
4129 if (!m_text.isEmpty())
4130 writer.writeCharacters(m_text);
4132 writer.writeEndElement();
4135DomResourceIcon::~DomResourceIcon()
4139 delete m_disabledOff;
4140 delete m_disabledOn;
4143 delete m_selectedOff;
4144 delete m_selectedOn;
4147void DomResourceIcon::read(QXmlStreamReader &reader)
4149 const QXmlStreamAttributes &attributes = reader.attributes();
4150 for (
const QXmlStreamAttribute &attribute : attributes) {
4151 const auto name = attribute.name();
4152 if (name == u"theme"_s) {
4153 setAttributeTheme(attribute.value().toString());
4156 if (name == u"resource"_s) {
4157 setAttributeResource(attribute.value().toString());
4160 reader.raiseError(
"Unexpected attribute "_L1 + name);
4163 while (!reader.hasError()) {
4164 switch (reader.readNext()) {
4165 case QXmlStreamReader::StartElement : {
4166 const auto tag = reader.name();
4167 if (!tag.compare(u"normaloff"_s, Qt::CaseInsensitive)) {
4168 auto *v =
new DomResourcePixmap();
4170 setElementNormalOff(v);
4173 if (!tag.compare(u"normalon"_s, Qt::CaseInsensitive)) {
4174 auto *v =
new DomResourcePixmap();
4176 setElementNormalOn(v);
4179 if (!tag.compare(u"disabledoff"_s, Qt::CaseInsensitive)) {
4180 auto *v =
new DomResourcePixmap();
4182 setElementDisabledOff(v);
4185 if (!tag.compare(u"disabledon"_s, Qt::CaseInsensitive)) {
4186 auto *v =
new DomResourcePixmap();
4188 setElementDisabledOn(v);
4191 if (!tag.compare(u"activeoff"_s, Qt::CaseInsensitive)) {
4192 auto *v =
new DomResourcePixmap();
4194 setElementActiveOff(v);
4197 if (!tag.compare(u"activeon"_s, Qt::CaseInsensitive)) {
4198 auto *v =
new DomResourcePixmap();
4200 setElementActiveOn(v);
4203 if (!tag.compare(u"selectedoff"_s, Qt::CaseInsensitive)) {
4204 auto *v =
new DomResourcePixmap();
4206 setElementSelectedOff(v);
4209 if (!tag.compare(u"selectedon"_s, Qt::CaseInsensitive)) {
4210 auto *v =
new DomResourcePixmap();
4212 setElementSelectedOn(v);
4215 reader.raiseError(
"Unexpected element "_L1 + tag);
4218 case QXmlStreamReader::EndElement :
4220 case QXmlStreamReader::Characters :
4221 if (!reader.isWhitespace())
4222 m_text.append(reader.text().toString());
4230void DomResourceIcon::write(QXmlStreamWriter &writer,
const QString &tagName)
const
4232 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"resourceicon") : tagName.toLower());
4234 if (hasAttributeTheme())
4235 writer.writeAttribute(u"theme"_s, attributeTheme());
4237 if (hasAttributeResource())
4238 writer.writeAttribute(u"resource"_s, attributeResource());
4240 if (m_children & NormalOff)
4241 m_normalOff->write(writer, u"normaloff"_s);
4243 if (m_children & NormalOn)
4244 m_normalOn->write(writer, u"normalon"_s);
4246 if (m_children & DisabledOff)
4247 m_disabledOff->write(writer, u"disabledoff"_s);
4249 if (m_children & DisabledOn)
4250 m_disabledOn->write(writer, u"disabledon"_s);
4252 if (m_children & ActiveOff)
4253 m_activeOff->write(writer, u"activeoff"_s);
4255 if (m_children & ActiveOn)
4256 m_activeOn->write(writer, u"activeon"_s);
4258 if (m_children & SelectedOff)
4259 m_selectedOff->write(writer, u"selectedoff"_s);
4261 if (m_children & SelectedOn)
4262 m_selectedOn->write(writer, u"selectedon"_s);
4264 if (!m_text.isEmpty())
4265 writer.writeCharacters(m_text);
4267 writer.writeEndElement();
4270DomResourcePixmap *DomResourceIcon::takeElementNormalOff()
4272 DomResourcePixmap *a = m_normalOff;
4273 m_normalOff =
nullptr;
4274 m_children ^= NormalOff;
4278void DomResourceIcon::setElementNormalOff(DomResourcePixmap *a)
4281 m_children |= NormalOff;
4285DomResourcePixmap *DomResourceIcon::takeElementNormalOn()
4287 DomResourcePixmap *a = m_normalOn;
4288 m_normalOn =
nullptr;
4289 m_children ^= NormalOn;
4293void DomResourceIcon::setElementNormalOn(DomResourcePixmap *a)
4296 m_children |= NormalOn;
4300DomResourcePixmap *DomResourceIcon::takeElementDisabledOff()
4302 DomResourcePixmap *a = m_disabledOff;
4303 m_disabledOff =
nullptr;
4304 m_children ^= DisabledOff;
4308void DomResourceIcon::setElementDisabledOff(DomResourcePixmap *a)
4310 delete m_disabledOff;
4311 m_children |= DisabledOff;
4315DomResourcePixmap *DomResourceIcon::takeElementDisabledOn()
4317 DomResourcePixmap *a = m_disabledOn;
4318 m_disabledOn =
nullptr;
4319 m_children ^= DisabledOn;
4323void DomResourceIcon::setElementDisabledOn(DomResourcePixmap *a)
4325 delete m_disabledOn;
4326 m_children |= DisabledOn;
4330DomResourcePixmap *DomResourceIcon::takeElementActiveOff()
4332 DomResourcePixmap *a = m_activeOff;
4333 m_activeOff =
nullptr;
4334 m_children ^= ActiveOff;
4338void DomResourceIcon::setElementActiveOff(DomResourcePixmap *a)
4341 m_children |= ActiveOff;
4345DomResourcePixmap *DomResourceIcon::takeElementActiveOn()
4347 DomResourcePixmap *a = m_activeOn;
4348 m_activeOn =
nullptr;
4349 m_children ^= ActiveOn;
4353void DomResourceIcon::setElementActiveOn(DomResourcePixmap *a)
4356 m_children |= ActiveOn;
4360DomResourcePixmap *DomResourceIcon::takeElementSelectedOff()
4362 DomResourcePixmap *a = m_selectedOff;
4363 m_selectedOff =
nullptr;
4364 m_children ^= SelectedOff;
4368void DomResourceIcon::setElementSelectedOff(DomResourcePixmap *a)
4370 delete m_selectedOff;
4371 m_children |= SelectedOff;
4375DomResourcePixmap *DomResourceIcon::takeElementSelectedOn()
4377 DomResourcePixmap *a = m_selectedOn;
4378 m_selectedOn =
nullptr;
4379 m_children ^= SelectedOn;
4383void DomResourceIcon::setElementSelectedOn(DomResourcePixmap *a)
4385 delete m_selectedOn;
4386 m_children |= SelectedOn;
4390void DomResourceIcon::clearElementNormalOff()
4393 m_normalOff =
nullptr;
4394 m_children &= ~NormalOff;
4397void DomResourceIcon::clearElementNormalOn()
4400 m_normalOn =
nullptr;
4401 m_children &= ~NormalOn;
4404void DomResourceIcon::clearElementDisabledOff()
4406 delete m_disabledOff;
4407 m_disabledOff =
nullptr;
4408 m_children &= ~DisabledOff;
4411void DomResourceIcon::clearElementDisabledOn()
4413 delete m_disabledOn;
4414 m_disabledOn =
nullptr;
4415 m_children &= ~DisabledOn;
4418void DomResourceIcon::clearElementActiveOff()
4421 m_activeOff =
nullptr;
4422 m_children &= ~ActiveOff;
4425void DomResourceIcon::clearElementActiveOn()
4428 m_activeOn =
nullptr;
4429 m_children &= ~ActiveOn;
4432void DomResourceIcon::clearElementSelectedOff()
4434 delete m_selectedOff;
4435 m_selectedOff =
nullptr;
4436 m_children &= ~SelectedOff;
4439void DomResourceIcon::clearElementSelectedOn()
4441 delete m_selectedOn;
4442 m_selectedOn =
nullptr;
4443 m_children &= ~SelectedOn;
4446DomString::~DomString() =
default;
4448void DomString::read(QXmlStreamReader &reader)
4450 const QXmlStreamAttributes &attributes = reader.attributes();
4451 for (
const QXmlStreamAttribute &attribute : attributes) {
4452 const auto name = attribute.name();
4453 if (name == u"notr"_s) {
4454 setAttributeNotr(attribute.value().toString());
4457 if (name == u"comment"_s) {
4458 setAttributeComment(attribute.value().toString());
4461 if (name == u"extracomment"_s) {
4462 setAttributeExtraComment(attribute.value().toString());
4465 if (name == u"id"_s) {
4466 setAttributeId(attribute.value().toString());
4469 reader.raiseError(
"Unexpected attribute "_L1 + name);
4472 while (!reader.hasError()) {
4473 switch (reader.readNext()) {
4474 case QXmlStreamReader::StartElement : {
4475 const auto tag = reader.name();
4476 reader.raiseError(
"Unexpected element "_L1 + tag);
4479 case QXmlStreamReader::EndElement :
4481 case QXmlStreamReader::Characters :
4482 if (!reader.isWhitespace())
4483 m_text.append(reader.text().toString());
4491void DomString::write(QXmlStreamWriter &writer,
const QString &tagName)
const
4493 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"string") : tagName.toLower());
4495 if (hasAttributeNotr())
4496 writer.writeAttribute(u"notr"_s, attributeNotr());
4498 if (hasAttributeComment())
4499 writer.writeAttribute(u"comment"_s, attributeComment());
4501 if (hasAttributeExtraComment())
4502 writer.writeAttribute(u"extracomment"_s, attributeExtraComment());
4504 if (hasAttributeId())
4505 writer.writeAttribute(u"id"_s, attributeId());
4507 if (!m_text.isEmpty())
4508 writer.writeCharacters(m_text);
4510 writer.writeEndElement();
4513DomPointF::~DomPointF() =
default;
4515void DomPointF::read(QXmlStreamReader &reader)
4517 while (!reader.hasError()) {
4518 switch (reader.readNext()) {
4519 case QXmlStreamReader::StartElement : {
4520 const auto tag = reader.name();
4521 if (!tag.compare(u"x"_s, Qt::CaseInsensitive)) {
4522 setElementX(reader.readElementText().toDouble());
4525 if (!tag.compare(u"y"_s, Qt::CaseInsensitive)) {
4526 setElementY(reader.readElementText().toDouble());
4529 reader.raiseError(
"Unexpected element "_L1 + tag);
4532 case QXmlStreamReader::EndElement :
4540void DomPointF::write(QXmlStreamWriter &writer,
const QString &tagName)
const
4542 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"pointf") : tagName.toLower());
4545 writer.writeTextElement(u"x"_s, QString::number(m_x,
'f', 15));
4548 writer.writeTextElement(u"y"_s, QString::number(m_y,
'f', 15));
4550 writer.writeEndElement();
4553void DomPointF::setElementX(
double a)
4559void DomPointF::setElementY(
double a)
4565void DomPointF::clearElementX()
4570void DomPointF::clearElementY()
4575DomRectF::~DomRectF() =
default;
4577void DomRectF::read(QXmlStreamReader &reader)
4579 while (!reader.hasError()) {
4580 switch (reader.readNext()) {
4581 case QXmlStreamReader::StartElement : {
4582 const auto tag = reader.name();
4583 if (!tag.compare(u"x"_s, Qt::CaseInsensitive)) {
4584 setElementX(reader.readElementText().toDouble());
4587 if (!tag.compare(u"y"_s, Qt::CaseInsensitive)) {
4588 setElementY(reader.readElementText().toDouble());
4591 if (!tag.compare(u"width"_s, Qt::CaseInsensitive)) {
4592 setElementWidth(reader.readElementText().toDouble());
4595 if (!tag.compare(u"height"_s, Qt::CaseInsensitive)) {
4596 setElementHeight(reader.readElementText().toDouble());
4599 reader.raiseError(
"Unexpected element "_L1 + tag);
4602 case QXmlStreamReader::EndElement :
4610void DomRectF::write(QXmlStreamWriter &writer,
const QString &tagName)
const
4612 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"rectf") : tagName.toLower());
4615 writer.writeTextElement(u"x"_s, QString::number(m_x,
'f', 15));
4618 writer.writeTextElement(u"y"_s, QString::number(m_y,
'f', 15));
4620 if (m_children & Width)
4621 writer.writeTextElement(u"width"_s, QString::number(m_width,
'f', 15));
4623 if (m_children & Height)
4624 writer.writeTextElement(u"height"_s, QString::number(m_height,
'f', 15));
4626 writer.writeEndElement();
4629void DomRectF::setElementX(
double a)
4635void DomRectF::setElementY(
double a)
4641void DomRectF::setElementWidth(
double a)
4643 m_children |= Width;
4647void DomRectF::setElementHeight(
double a)
4649 m_children |= Height;
4653void DomRectF::clearElementX()
4658void DomRectF::clearElementY()
4663void DomRectF::clearElementWidth()
4665 m_children &= ~Width;
4668void DomRectF::clearElementHeight()
4670 m_children &= ~Height;
4673DomSizeF::~DomSizeF() =
default;
4675void DomSizeF::read(QXmlStreamReader &reader)
4677 while (!reader.hasError()) {
4678 switch (reader.readNext()) {
4679 case QXmlStreamReader::StartElement : {
4680 const auto tag = reader.name();
4681 if (!tag.compare(u"width"_s, Qt::CaseInsensitive)) {
4682 setElementWidth(reader.readElementText().toDouble());
4685 if (!tag.compare(u"height"_s, Qt::CaseInsensitive)) {
4686 setElementHeight(reader.readElementText().toDouble());
4689 reader.raiseError(
"Unexpected element "_L1 + tag);
4692 case QXmlStreamReader::EndElement :
4700void DomSizeF::write(QXmlStreamWriter &writer,
const QString &tagName)
const
4702 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"sizef") : tagName.toLower());
4704 if (m_children & Width)
4705 writer.writeTextElement(u"width"_s, QString::number(m_width,
'f', 15));
4707 if (m_children & Height)
4708 writer.writeTextElement(u"height"_s, QString::number(m_height,
'f', 15));
4710 writer.writeEndElement();
4713void DomSizeF::setElementWidth(
double a)
4715 m_children |= Width;
4719void DomSizeF::setElementHeight(
double a)
4721 m_children |= Height;
4725void DomSizeF::clearElementWidth()
4727 m_children &= ~Width;
4730void DomSizeF::clearElementHeight()
4732 m_children &= ~Height;
4735DomChar::~DomChar() =
default;
4737void DomChar::read(QXmlStreamReader &reader)
4739 while (!reader.hasError()) {
4740 switch (reader.readNext()) {
4741 case QXmlStreamReader::StartElement : {
4742 const auto tag = reader.name();
4743 if (!tag.compare(u"unicode"_s, Qt::CaseInsensitive)) {
4744 setElementUnicode(reader.readElementText().toInt());
4747 reader.raiseError(
"Unexpected element "_L1 + tag);
4750 case QXmlStreamReader::EndElement :
4758void DomChar::write(QXmlStreamWriter &writer,
const QString &tagName)
const
4760 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"char") : tagName.toLower());
4762 if (m_children & Unicode)
4763 writer.writeTextElement(u"unicode"_s, QString::number(m_unicode));
4765 writer.writeEndElement();
4768void DomChar::setElementUnicode(
int a)
4770 m_children |= Unicode;
4774void DomChar::clearElementUnicode()
4776 m_children &= ~Unicode;
4784void DomUrl::read(QXmlStreamReader &reader)
4786 while (!reader.hasError()) {
4787 switch (reader.readNext()) {
4788 case QXmlStreamReader::StartElement : {
4789 const auto tag = reader.name();
4790 if (!tag.compare(u"string"_s, Qt::CaseInsensitive)) {
4791 auto *v =
new DomString();
4793 setElementString(v);
4796 reader.raiseError(
"Unexpected element "_L1 + tag);
4799 case QXmlStreamReader::EndElement :
4807void DomUrl::write(QXmlStreamWriter &writer,
const QString &tagName)
const
4809 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"url") : tagName.toLower());
4811 if (m_children & String)
4812 m_string->write(writer, u"string"_s);
4814 writer.writeEndElement();
4817DomString *DomUrl::takeElementString()
4819 DomString *a = m_string;
4821 m_children ^= String;
4825void DomUrl::setElementString(DomString *a)
4828 m_children |= String;
4832void DomUrl::clearElementString()
4836 m_children &= ~String;
4839DomProperty::~DomProperty()
4849 delete m_sizePolicy;
4852 delete m_stringList;
4864void DomProperty::clear()
4874 delete m_sizePolicy;
4877 delete m_stringList;
4893 m_iconSet =
nullptr;
4895 m_palette =
nullptr;
4899 m_sizePolicy =
nullptr;
4902 m_stringList =
nullptr;
4908 m_dateTime =
nullptr;
4920void DomProperty::read(QXmlStreamReader &reader)
4922 const QXmlStreamAttributes &attributes = reader.attributes();
4923 for (
const QXmlStreamAttribute &attribute : attributes) {
4924 const auto name = attribute.name();
4925 if (name == u"name"_s) {
4926 setAttributeName(attribute.value().toString());
4929 if (name == u"stdset"_s) {
4930 setAttributeStdset(attribute.value().toInt());
4933 reader.raiseError(
"Unexpected attribute "_L1 + name);
4936 while (!reader.hasError()) {
4937 switch (reader.readNext()) {
4938 case QXmlStreamReader::StartElement : {
4939 const auto tag = reader.name();
4940 if (!tag.compare(u"bool"_s, Qt::CaseInsensitive)) {
4941 setElementBool(reader.readElementText());
4944 if (!tag.compare(u"color"_s, Qt::CaseInsensitive)) {
4945 auto *v =
new DomColor();
4950 if (!tag.compare(u"cstring"_s, Qt::CaseInsensitive)) {
4951 setElementCstring(reader.readElementText());
4954 if (!tag.compare(u"cursor"_s, Qt::CaseInsensitive)) {
4955 setElementCursor(reader.readElementText().toInt());
4958 if (!tag.compare(u"cursorshape"_s, Qt::CaseInsensitive)) {
4959 setElementCursorShape(reader.readElementText());
4962 if (!tag.compare(u"enum"_s, Qt::CaseInsensitive)) {
4963 setElementEnum(reader.readElementText());
4966 if (!tag.compare(u"font"_s, Qt::CaseInsensitive)) {
4967 auto *v =
new DomFont();
4972 if (!tag.compare(u"iconset"_s, Qt::CaseInsensitive)) {
4973 auto *v =
new DomResourceIcon();
4975 setElementIconSet(v);
4978 if (!tag.compare(u"pixmap"_s, Qt::CaseInsensitive)) {
4979 auto *v =
new DomResourcePixmap();
4981 setElementPixmap(v);
4984 if (!tag.compare(u"palette"_s, Qt::CaseInsensitive)) {
4985 auto *v =
new DomPalette();
4987 setElementPalette(v);
4990 if (!tag.compare(u"point"_s, Qt::CaseInsensitive)) {
4991 auto *v =
new DomPoint();
4996 if (!tag.compare(u"rect"_s, Qt::CaseInsensitive)) {
4997 auto *v =
new DomRect();
5002 if (!tag.compare(u"set"_s, Qt::CaseInsensitive)) {
5003 setElementSet(reader.readElementText());
5006 if (!tag.compare(u"locale"_s, Qt::CaseInsensitive)) {
5007 auto *v =
new DomLocale();
5009 setElementLocale(v);
5012 if (!tag.compare(u"sizepolicy"_s, Qt::CaseInsensitive)) {
5013 auto *v =
new DomSizePolicy();
5015 setElementSizePolicy(v);
5018 if (!tag.compare(u"size"_s, Qt::CaseInsensitive)) {
5019 auto *v =
new DomSize();
5024 if (!tag.compare(u"string"_s, Qt::CaseInsensitive)) {
5025 auto *v =
new DomString();
5027 setElementString(v);
5030 if (!tag.compare(u"stringlist"_s, Qt::CaseInsensitive)) {
5031 auto *v =
new DomStringList();
5033 setElementStringList(v);
5036 if (!tag.compare(u"number"_s, Qt::CaseInsensitive)) {
5037 setElementNumber(reader.readElementText().toInt());
5040 if (!tag.compare(u"float"_s, Qt::CaseInsensitive)) {
5041 setElementFloat(reader.readElementText().toFloat());
5044 if (!tag.compare(u"double"_s, Qt::CaseInsensitive)) {
5045 setElementDouble(reader.readElementText().toDouble());
5048 if (!tag.compare(u"date"_s, Qt::CaseInsensitive)) {
5049 auto *v =
new DomDate();
5054 if (!tag.compare(u"time"_s, Qt::CaseInsensitive)) {
5055 auto *v =
new DomTime();
5060 if (!tag.compare(u"datetime"_s, Qt::CaseInsensitive)) {
5061 auto *v =
new DomDateTime();
5063 setElementDateTime(v);
5066 if (!tag.compare(u"pointf"_s, Qt::CaseInsensitive)) {
5067 auto *v =
new DomPointF();
5069 setElementPointF(v);
5072 if (!tag.compare(u"rectf"_s, Qt::CaseInsensitive)) {
5073 auto *v =
new DomRectF();
5078 if (!tag.compare(u"sizef"_s, Qt::CaseInsensitive)) {
5079 auto *v =
new DomSizeF();
5084 if (!tag.compare(u"longlong"_s, Qt::CaseInsensitive)) {
5085 setElementLongLong(reader.readElementText().toLongLong());
5088 if (!tag.compare(u"char"_s, Qt::CaseInsensitive)) {
5089 auto *v =
new DomChar();
5094 if (!tag.compare(u"url"_s, Qt::CaseInsensitive)) {
5095 auto *v =
new DomUrl();
5100 if (!tag.compare(u"uint"_s, Qt::CaseInsensitive)) {
5101 setElementUInt(reader.readElementText().toUInt());
5104 if (!tag.compare(u"ulonglong"_s, Qt::CaseInsensitive)) {
5105 setElementULongLong(reader.readElementText().toULongLong());
5108 if (!tag.compare(u"brush"_s, Qt::CaseInsensitive)) {
5109 auto *v =
new DomBrush();
5114 reader.raiseError(
"Unexpected element "_L1 + tag);
5117 case QXmlStreamReader::EndElement :
5125void DomProperty::write(QXmlStreamWriter &writer,
const QString &tagName)
const
5127 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"property") : tagName.toLower());
5129 if (hasAttributeName())
5130 writer.writeAttribute(u"name"_s, attributeName());
5132 if (hasAttributeStdset())
5133 writer.writeAttribute(u"stdset"_s, QString::number(attributeStdset()));
5137 writer.writeTextElement(u"bool"_s, elementBool());
5141 if (m_color !=
nullptr)
5142 m_color->write(writer, u"color"_s);
5146 writer.writeTextElement(u"cstring"_s, elementCstring());
5150 writer.writeTextElement(u"cursor"_s, QString::number(elementCursor()));
5154 writer.writeTextElement(u"cursorShape"_s, elementCursorShape());
5158 writer.writeTextElement(u"enum"_s, elementEnum());
5162 if (m_font !=
nullptr)
5163 m_font->write(writer, u"font"_s);
5167 if (m_iconSet !=
nullptr)
5168 m_iconSet->write(writer, u"iconset"_s);
5172 if (m_pixmap !=
nullptr)
5173 m_pixmap->write(writer, u"pixmap"_s);
5177 if (m_palette !=
nullptr)
5178 m_palette->write(writer, u"palette"_s);
5182 if (m_point !=
nullptr)
5183 m_point->write(writer, u"point"_s);
5187 if (m_rect !=
nullptr)
5188 m_rect->write(writer, u"rect"_s);
5192 writer.writeTextElement(u"set"_s, elementSet());
5196 if (m_locale !=
nullptr)
5197 m_locale->write(writer, u"locale"_s);
5201 if (m_sizePolicy !=
nullptr)
5202 m_sizePolicy->write(writer, u"sizepolicy"_s);
5206 if (m_size !=
nullptr)
5207 m_size->write(writer, u"size"_s);
5211 if (m_string !=
nullptr)
5212 m_string->write(writer, u"string"_s);
5216 if (m_stringList !=
nullptr)
5217 m_stringList->write(writer, u"stringlist"_s);
5221 writer.writeTextElement(u"number"_s, QString::number(elementNumber()));
5225 writer.writeTextElement(u"float"_s, QString::number(elementFloat(),
'f', 8));
5229 writer.writeTextElement(u"double"_s, QString::number(elementDouble(),
'f', 15));
5233 if (m_date !=
nullptr)
5234 m_date->write(writer, u"date"_s);
5238 if (m_time !=
nullptr)
5239 m_time->write(writer, u"time"_s);
5243 if (m_dateTime !=
nullptr)
5244 m_dateTime->write(writer, u"datetime"_s);
5248 if (m_pointF !=
nullptr)
5249 m_pointF->write(writer, u"pointf"_s);
5253 if (m_rectF !=
nullptr)
5254 m_rectF->write(writer, u"rectf"_s);
5258 if (m_sizeF !=
nullptr)
5259 m_sizeF->write(writer, u"sizef"_s);
5263 writer.writeTextElement(u"longLong"_s, QString::number(elementLongLong()));
5267 if (m_char !=
nullptr)
5268 m_char->write(writer, u"char"_s);
5272 if (m_url !=
nullptr)
5273 m_url->write(writer, u"url"_s);
5277 writer.writeTextElement(u"UInt"_s, QString::number(elementUInt()));
5281 writer.writeTextElement(u"uLongLong"_s, QString::number(elementULongLong()));
5285 if (m_brush !=
nullptr)
5286 m_brush->write(writer, u"brush"_s);
5292 writer.writeEndElement();
5295void DomProperty::setElementBool(
const QString &a)
5302DomColor *DomProperty::takeElementColor()
5304 DomColor *a = m_color;
5309void DomProperty::setElementColor(DomColor *a)
5316void DomProperty::setElementCstring(
const QString &a)
5323void DomProperty::setElementCursor(
int a)
5330void DomProperty::setElementCursorShape(
const QString &a)
5333 m_kind = CursorShape;
5337void DomProperty::setElementEnum(
const QString &a)
5344DomFont *DomProperty::takeElementFont()
5346 DomFont *a = m_font;
5351void DomProperty::setElementFont(DomFont *a)
5358DomResourceIcon *DomProperty::takeElementIconSet()
5360 DomResourceIcon *a = m_iconSet;
5361 m_iconSet =
nullptr;
5365void DomProperty::setElementIconSet(DomResourceIcon *a)
5372DomResourcePixmap *DomProperty::takeElementPixmap()
5374 DomResourcePixmap *a = m_pixmap;
5379void DomProperty::setElementPixmap(DomResourcePixmap *a)
5386DomPalette *DomProperty::takeElementPalette()
5388 DomPalette *a = m_palette;
5389 m_palette =
nullptr;
5393void DomProperty::setElementPalette(DomPalette *a)
5400DomPoint *DomProperty::takeElementPoint()
5402 DomPoint *a = m_point;
5407void DomProperty::setElementPoint(DomPoint *a)
5414DomRect *DomProperty::takeElementRect()
5416 DomRect *a = m_rect;
5421void DomProperty::setElementRect(DomRect *a)
5428void DomProperty::setElementSet(
const QString &a)
5435DomLocale *DomProperty::takeElementLocale()
5437 DomLocale *a = m_locale;
5442void DomProperty::setElementLocale(DomLocale *a)
5449DomSizePolicy *DomProperty::takeElementSizePolicy()
5451 DomSizePolicy *a = m_sizePolicy;
5452 m_sizePolicy =
nullptr;
5456void DomProperty::setElementSizePolicy(DomSizePolicy *a)
5459 m_kind = SizePolicy;
5463DomSize *DomProperty::takeElementSize()
5465 DomSize *a = m_size;
5470void DomProperty::setElementSize(DomSize *a)
5477DomString *DomProperty::takeElementString()
5479 DomString *a = m_string;
5484void DomProperty::setElementString(DomString *a)
5491DomStringList *DomProperty::takeElementStringList()
5493 DomStringList *a = m_stringList;
5494 m_stringList =
nullptr;
5498void DomProperty::setElementStringList(DomStringList *a)
5501 m_kind = StringList;
5505void DomProperty::setElementNumber(
int a)
5512void DomProperty::setElementFloat(
float a)
5519void DomProperty::setElementDouble(
double a)
5526DomDate *DomProperty::takeElementDate()
5528 DomDate *a = m_date;
5533void DomProperty::setElementDate(DomDate *a)
5540DomTime *DomProperty::takeElementTime()
5542 DomTime *a = m_time;
5547void DomProperty::setElementTime(DomTime *a)
5554DomDateTime *DomProperty::takeElementDateTime()
5556 DomDateTime *a = m_dateTime;
5557 m_dateTime =
nullptr;
5561void DomProperty::setElementDateTime(DomDateTime *a)
5568DomPointF *DomProperty::takeElementPointF()
5570 DomPointF *a = m_pointF;
5575void DomProperty::setElementPointF(DomPointF *a)
5582DomRectF *DomProperty::takeElementRectF()
5584 DomRectF *a = m_rectF;
5589void DomProperty::setElementRectF(DomRectF *a)
5596DomSizeF *DomProperty::takeElementSizeF()
5598 DomSizeF *a = m_sizeF;
5603void DomProperty::setElementSizeF(DomSizeF *a)
5610void DomProperty::setElementLongLong(qlonglong a)
5617DomChar *DomProperty::takeElementChar()
5619 DomChar *a = m_char;
5624void DomProperty::setElementChar(DomChar *a)
5631DomUrl *DomProperty::takeElementUrl()
5638void DomProperty::setElementUrl(DomUrl *a)
5645void DomProperty::setElementUInt(uint a)
5652void DomProperty::setElementULongLong(qulonglong a)
5659DomBrush *DomProperty::takeElementBrush()
5661 DomBrush *a = m_brush;
5666void DomProperty::setElementBrush(DomBrush *a)
5673DomConnections::~DomConnections()
5675 qDeleteAll(m_connection);
5676 m_connection.clear();
5679void DomConnections::read(QXmlStreamReader &reader)
5681 while (!reader.hasError()) {
5682 switch (reader.readNext()) {
5683 case QXmlStreamReader::StartElement : {
5684 const auto tag = reader.name();
5685 if (!tag.compare(u"connection"_s, Qt::CaseInsensitive)) {
5686 auto *v =
new DomConnection();
5688 m_connection.append(v);
5691 reader.raiseError(
"Unexpected element "_L1 + tag);
5694 case QXmlStreamReader::EndElement :
5702void DomConnections::write(QXmlStreamWriter &writer,
const QString &tagName)
const
5704 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"connections") : tagName.toLower());
5706 for (DomConnection *v : m_connection)
5707 v->write(writer, u"connection"_s);
5709 writer.writeEndElement();
5712void DomConnections::setElementConnection(
const QList<DomConnection *> &a)
5714 m_children |= Connection;
5718DomConnection::~DomConnection()
5723void DomConnection::read(QXmlStreamReader &reader)
5725 while (!reader.hasError()) {
5726 switch (reader.readNext()) {
5727 case QXmlStreamReader::StartElement : {
5728 const auto tag = reader.name();
5729 if (!tag.compare(u"sender"_s, Qt::CaseInsensitive)) {
5730 setElementSender(reader.readElementText());
5733 if (!tag.compare(u"signal"_s, Qt::CaseInsensitive)) {
5734 setElementSignal(reader.readElementText());
5737 if (!tag.compare(u"receiver"_s, Qt::CaseInsensitive)) {
5738 setElementReceiver(reader.readElementText());
5741 if (!tag.compare(u"slot"_s, Qt::CaseInsensitive)) {
5742 setElementSlot(reader.readElementText());
5745 if (!tag.compare(u"hints"_s, Qt::CaseInsensitive)) {
5746 auto *v =
new DomConnectionHints();
5751 reader.raiseError(
"Unexpected element "_L1 + tag);
5754 case QXmlStreamReader::EndElement :
5762void DomConnection::write(QXmlStreamWriter &writer,
const QString &tagName)
const
5764 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"connection") : tagName.toLower());
5766 if (m_children & Sender)
5767 writer.writeTextElement(u"sender"_s, m_sender);
5769 if (m_children & Signal)
5770 writer.writeTextElement(u"signal"_s, m_signal);
5772 if (m_children & Receiver)
5773 writer.writeTextElement(u"receiver"_s, m_receiver);
5775 if (m_children & Slot)
5776 writer.writeTextElement(u"slot"_s, m_slot);
5778 if (m_children & Hints)
5779 m_hints->write(writer, u"hints"_s);
5781 writer.writeEndElement();
5784void DomConnection::setElementSender(
const QString &a)
5786 m_children |= Sender;
5790void DomConnection::setElementSignal(
const QString &a)
5792 m_children |= Signal;
5796void DomConnection::setElementReceiver(
const QString &a)
5798 m_children |= Receiver;
5802void DomConnection::setElementSlot(
const QString &a)
5808DomConnectionHints *DomConnection::takeElementHints()
5810 DomConnectionHints *a = m_hints;
5812 m_children ^= Hints;
5816void DomConnection::setElementHints(DomConnectionHints *a)
5819 m_children |= Hints;
5823void DomConnection::clearElementSender()
5825 m_children &= ~Sender;
5828void DomConnection::clearElementSignal()
5830 m_children &= ~Signal;
5833void DomConnection::clearElementReceiver()
5835 m_children &= ~Receiver;
5838void DomConnection::clearElementSlot()
5840 m_children &= ~Slot;
5843void DomConnection::clearElementHints()
5847 m_children &= ~Hints;
5850DomConnectionHints::~DomConnectionHints()
5856void DomConnectionHints::read(QXmlStreamReader &reader)
5858 while (!reader.hasError()) {
5859 switch (reader.readNext()) {
5860 case QXmlStreamReader::StartElement : {
5861 const auto tag = reader.name();
5862 if (!tag.compare(u"hint"_s, Qt::CaseInsensitive)) {
5863 auto *v =
new DomConnectionHint();
5868 reader.raiseError(
"Unexpected element "_L1 + tag);
5871 case QXmlStreamReader::EndElement :
5879void DomConnectionHints::write(QXmlStreamWriter &writer,
const QString &tagName)
const
5881 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"connectionhints") : tagName.toLower());
5883 for (DomConnectionHint *v : m_hint)
5884 v->write(writer, u"hint"_s);
5886 writer.writeEndElement();
5889void DomConnectionHints::setElementHint(
const QList<DomConnectionHint *> &a)
5895DomConnectionHint::~DomConnectionHint() =
default;
5897void DomConnectionHint::read(QXmlStreamReader &reader)
5899 const QXmlStreamAttributes &attributes = reader.attributes();
5900 for (
const QXmlStreamAttribute &attribute : attributes) {
5901 const auto name = attribute.name();
5902 if (name == u"type"_s) {
5903 setAttributeType(attribute.value().toString());
5906 reader.raiseError(
"Unexpected attribute "_L1 + name);
5909 while (!reader.hasError()) {
5910 switch (reader.readNext()) {
5911 case QXmlStreamReader::StartElement : {
5912 const auto tag = reader.name();
5913 if (!tag.compare(u"x"_s, Qt::CaseInsensitive)) {
5914 setElementX(reader.readElementText().toInt());
5917 if (!tag.compare(u"y"_s, Qt::CaseInsensitive)) {
5918 setElementY(reader.readElementText().toInt());
5921 reader.raiseError(
"Unexpected element "_L1 + tag);
5924 case QXmlStreamReader::EndElement :
5932void DomConnectionHint::write(QXmlStreamWriter &writer,
const QString &tagName)
const
5934 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"connectionhint") : tagName.toLower());
5936 if (hasAttributeType())
5937 writer.writeAttribute(u"type"_s, attributeType());
5940 writer.writeTextElement(u"x"_s, QString::number(m_x));
5943 writer.writeTextElement(u"y"_s, QString::number(m_y));
5945 writer.writeEndElement();
5948void DomConnectionHint::setElementX(
int a)
5954void DomConnectionHint::setElementY(
int a)
5960void DomConnectionHint::clearElementX()
5965void DomConnectionHint::clearElementY()
5970DomDesignerData::~DomDesignerData()
5972 qDeleteAll(m_property);
5976void DomDesignerData::read(QXmlStreamReader &reader)
5978 while (!reader.hasError()) {
5979 switch (reader.readNext()) {
5980 case QXmlStreamReader::StartElement : {
5981 const auto tag = reader.name();
5982 if (!tag.compare(u"property"_s, Qt::CaseInsensitive)) {
5983 auto *v =
new DomProperty();
5985 m_property.append(v);
5988 reader.raiseError(
"Unexpected element "_L1 + tag);
5991 case QXmlStreamReader::EndElement :
5999void DomDesignerData::write(QXmlStreamWriter &writer,
const QString &tagName)
const
6001 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"designerdata") : tagName.toLower());
6003 for (DomProperty *v : m_property)
6004 v->write(writer, u"property"_s);
6006 writer.writeEndElement();
6009void DomDesignerData::setElementProperty(
const QList<DomProperty *> &a)
6011 m_children |= Property;
6015DomSlots::~DomSlots()
6021void DomSlots::read(QXmlStreamReader &reader)
6023 while (!reader.hasError()) {
6024 switch (reader.readNext()) {
6025 case QXmlStreamReader::StartElement : {
6026 const auto tag = reader.name();
6027 if (!tag.compare(u"signal"_s, Qt::CaseInsensitive)) {
6028 m_signal.append(reader.readElementText());
6031 if (!tag.compare(u"slot"_s, Qt::CaseInsensitive)) {
6032 m_slot.append(reader.readElementText());
6035 reader.raiseError(
"Unexpected element "_L1 + tag);
6038 case QXmlStreamReader::EndElement :
6046void DomSlots::write(QXmlStreamWriter &writer,
const QString &tagName)
const
6048 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"slots") : tagName.toLower());
6050 for (
const QString &v : m_signal)
6051 writer.writeTextElement(u"signal"_s, v);
6053 for (
const QString &v : m_slot)
6054 writer.writeTextElement(u"slot"_s, v);
6056 writer.writeEndElement();
6059void DomSlots::setElementSignal(
const QStringList &a)
6061 m_children |= Signal;
6065void DomSlots::setElementSlot(
const QStringList &a)
6071DomPropertySpecifications::~DomPropertySpecifications()
6073 qDeleteAll(m_tooltip);
6075 qDeleteAll(m_stringpropertyspecification);
6076 m_stringpropertyspecification.clear();
6079void DomPropertySpecifications::read(QXmlStreamReader &reader)
6081 while (!reader.hasError()) {
6082 switch (reader.readNext()) {
6083 case QXmlStreamReader::StartElement : {
6084 const auto tag = reader.name();
6085 if (!tag.compare(u"tooltip"_s, Qt::CaseInsensitive)) {
6086 auto *v =
new DomPropertyToolTip();
6088 m_tooltip.append(v);
6091 if (!tag.compare(u"stringpropertyspecification"_s, Qt::CaseInsensitive)) {
6092 auto *v =
new DomStringPropertySpecification();
6094 m_stringpropertyspecification.append(v);
6097 reader.raiseError(
"Unexpected element "_L1 + tag);
6100 case QXmlStreamReader::EndElement :
6108void DomPropertySpecifications::write(QXmlStreamWriter &writer,
const QString &tagName)
const
6110 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"propertyspecifications") : tagName.toLower());
6112 for (DomPropertyToolTip *v : m_tooltip)
6113 v->write(writer, u"tooltip"_s);
6115 for (DomStringPropertySpecification *v : m_stringpropertyspecification)
6116 v->write(writer, u"stringpropertyspecification"_s);
6118 writer.writeEndElement();
6121void DomPropertySpecifications::setElementTooltip(
const QList<DomPropertyToolTip *> &a)
6123 m_children |= Tooltip;
6127void DomPropertySpecifications::setElementStringpropertyspecification(
const QList<DomStringPropertySpecification *> &a)
6129 m_children |= Stringpropertyspecification;
6130 m_stringpropertyspecification = a;
6133DomPropertyToolTip::~DomPropertyToolTip() =
default;
6135void DomPropertyToolTip::read(QXmlStreamReader &reader)
6137 const QXmlStreamAttributes &attributes = reader.attributes();
6138 for (
const QXmlStreamAttribute &attribute : attributes) {
6139 const auto name = attribute.name();
6140 if (name == u"name"_s) {
6141 setAttributeName(attribute.value().toString());
6144 reader.raiseError(
"Unexpected attribute "_L1 + name);
6147 while (!reader.hasError()) {
6148 switch (reader.readNext()) {
6149 case QXmlStreamReader::StartElement : {
6150 const auto tag = reader.name();
6151 reader.raiseError(
"Unexpected element "_L1 + tag);
6154 case QXmlStreamReader::EndElement :
6162void DomPropertyToolTip::write(QXmlStreamWriter &writer,
const QString &tagName)
const
6164 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"propertytooltip") : tagName.toLower());
6166 if (hasAttributeName())
6167 writer.writeAttribute(u"name"_s, attributeName());
6169 writer.writeEndElement();
6172DomStringPropertySpecification::~DomStringPropertySpecification() =
default;
6174void DomStringPropertySpecification::read(QXmlStreamReader &reader)
6176 const QXmlStreamAttributes &attributes = reader.attributes();
6177 for (
const QXmlStreamAttribute &attribute : attributes) {
6178 const auto name = attribute.name();
6179 if (name == u"name"_s) {
6180 setAttributeName(attribute.value().toString());
6183 if (name == u"type"_s) {
6184 setAttributeType(attribute.value().toString());
6187 if (name == u"notr"_s) {
6188 setAttributeNotr(attribute.value().toString());
6191 reader.raiseError(
"Unexpected attribute "_L1 + name);
6194 while (!reader.hasError()) {
6195 switch (reader.readNext()) {
6196 case QXmlStreamReader::StartElement : {
6197 const auto tag = reader.name();
6198 reader.raiseError(
"Unexpected element "_L1 + tag);
6201 case QXmlStreamReader::EndElement :
6209void DomStringPropertySpecification::write(QXmlStreamWriter &writer,
const QString &tagName)
const
6211 writer.writeStartElement(tagName.isEmpty() ?
QStringLiteral(
"stringpropertyspecification") : tagName.toLower());
6213 if (hasAttributeName())
6214 writer.writeAttribute(u"name"_s, attributeName());
6216 if (hasAttributeType())
6217 writer.writeAttribute(u"type"_s, attributeType());
6219 if (hasAttributeNotr())
6220 writer.writeAttribute(u"notr"_s, attributeNotr());
6222 writer.writeEndElement();
Combined button and popup list for selecting options.
#define QStringLiteral(str)