36void DomUI::read(QXmlStreamReader &reader)
38 const QXmlStreamAttributes &attributes = reader.attributes();
39 for (
const QXmlStreamAttribute &attribute : attributes) {
40 const auto name = attribute.name();
41 if (name == u"version"_s) {
42 setAttributeVersion(attribute.value().toString());
45 if (name == u"language"_s) {
46 setAttributeLanguage(attribute.value().toString());
49 if (name == u"displayname"_s) {
50 setAttributeDisplayname(attribute.value().toString());
53 if (name == u"idbasedtr"_s) {
54 setAttributeIdbasedtr(attribute.value() == u"true"_s);
57 if (name == u"connectslotsbyname"_s) {
58 setAttributeConnectslotsbyname(attribute.value() == u"true"_s);
61 if (name == u"stdsetdef"_s) {
62 setAttributeStdsetdef(attribute.value().toInt());
65 if (name == u"stdSetDef"_s) {
66 setAttributeStdSetDef(attribute.value().toInt());
69 reader.raiseError(
"Unexpected attribute "_L1 + name);
72 while (!reader.hasError()) {
73 switch (reader.readNext()) {
74 case QXmlStreamReader::StartElement : {
75 const auto tag = reader.name();
76 if (!tag.compare(u"author"_s, Qt::CaseInsensitive)) {
77 setElementAuthor(reader.readElementText());
80 if (!tag.compare(u"comment"_s, Qt::CaseInsensitive)
81 || !tag.compare(u"legal"_s, Qt::CaseInsensitive)) {
82 setElementComment(reader.readElementText());
85 if (!tag.compare(u"exportmacro"_s, Qt::CaseInsensitive)) {
86 setElementExportMacro(reader.readElementText());
89 if (!tag.compare(u"class"_s, Qt::CaseInsensitive)) {
90 setElementClass(reader.readElementText());
93 if (!tag.compare(u"widget"_s, Qt::CaseInsensitive)) {
94 auto *v =
new DomWidget();
99 if (!tag.compare(u"layoutdefault"_s, Qt::CaseInsensitive)) {
100 auto *v =
new DomLayoutDefault();
102 setElementLayoutDefault(v);
105 if (!tag.compare(u"layoutfunction"_s, Qt::CaseInsensitive)) {
106 auto *v =
new DomLayoutFunction();
108 setElementLayoutFunction(v);
111 if (!tag.compare(u"pixmapfunction"_s, Qt::CaseInsensitive)) {
112 setElementPixmapFunction(reader.readElementText());
115 if (!tag.compare(u"customwidgets"_s, Qt::CaseInsensitive)) {
116 auto *v =
new DomCustomWidgets();
118 setElementCustomWidgets(v);
121 if (!tag.compare(u"tabstops"_s, Qt::CaseInsensitive)) {
122 auto *v =
new DomTabStops();
124 setElementTabStops(v);
127 if (!tag.compare(u"images"_s, Qt::CaseInsensitive)) {
128 qWarning(
"Omitting deprecated element <images>.");
129 reader.skipCurrentElement();
132 if (!tag.compare(u"includes"_s, Qt::CaseInsensitive)) {
133 auto *v =
new DomIncludes();
135 setElementIncludes(v);
138 if (!tag.compare(u"resources"_s, Qt::CaseInsensitive)) {
139 auto *v =
new DomResources();
141 setElementResources(v);
144 if (!tag.compare(u"connections"_s, Qt::CaseInsensitive)) {
145 auto *v =
new DomConnections();
147 setElementConnections(v);
150 if (!tag.compare(u"designerdata"_s, Qt::CaseInsensitive)) {
151 auto *v =
new DomDesignerData();
153 setElementDesignerdata(v);
156 if (!tag.compare(u"slots"_s, Qt::CaseInsensitive)) {
157 auto *v =
new DomSlots();
162 if (!tag.compare(u"buttongroups"_s, Qt::CaseInsensitive)) {
163 auto *v =
new DomButtonGroups();
165 setElementButtonGroups(v);
168 reader.raiseError(
"Unexpected element "_L1 + tag);
171 case QXmlStreamReader::EndElement :
179void DomUI::write(QXmlStreamWriter &writer,
const QString &tagName)
const
181 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral(
"ui") : tagName.toLower());
183 if (hasAttributeVersion())
184 writer.writeAttribute(u"version"_s, attributeVersion());
186 if (hasAttributeLanguage())
187 writer.writeAttribute(u"language"_s, attributeLanguage());
189 if (hasAttributeDisplayname())
190 writer.writeAttribute(u"displayname"_s, attributeDisplayname());
192 if (hasAttributeIdbasedtr())
193 writer.writeAttribute(u"idbasedtr"_s, (attributeIdbasedtr() ? u"true"_s : u"false"_s));
195 if (hasAttributeConnectslotsbyname())
196 writer.writeAttribute(u"connectslotsbyname"_s, (attributeConnectslotsbyname() ? u"true"_s : u"false"_s));
198 if (hasAttributeStdsetdef())
199 writer.writeAttribute(u"stdsetdef"_s, QString::number(attributeStdsetdef()));
201 if (hasAttributeStdSetDef())
202 writer.writeAttribute(u"stdsetdef"_s, QString::number(attributeStdSetDef()));
204 if (m_children & Author)
205 writer.writeTextElement(u"author"_s, m_author);
207 if (m_children & Comment)
208 writer.writeTextElement(u"comment"_s, m_comment);
210 if (m_children & ExportMacro)
211 writer.writeTextElement(u"exportmacro"_s, m_exportMacro);
213 if (m_children & Class)
214 writer.writeTextElement(u"class"_s, m_class);
216 if (m_children & Widget)
217 m_widget->write(writer, u"widget"_s);
219 if (m_children & LayoutDefault)
220 m_layoutDefault->write(writer, u"layoutdefault"_s);
222 if (m_children & LayoutFunction)
223 m_layoutFunction->write(writer, u"layoutfunction"_s);
225 if (m_children & PixmapFunction)
226 writer.writeTextElement(u"pixmapfunction"_s, m_pixmapFunction);
228 if (m_children & CustomWidgets)
229 m_customWidgets->write(writer, u"customwidgets"_s);
231 if (m_children & TabStops)
232 m_tabStops->write(writer, u"tabstops"_s);
234 if (m_children & Includes)
235 m_includes->write(writer, u"includes"_s);
237 if (m_children & Resources)
238 m_resources->write(writer, u"resources"_s);
240 if (m_children & Connections)
241 m_connections->write(writer, u"connections"_s);
243 if (m_children & Designerdata)
244 m_designerdata->write(writer, u"designerdata"_s);
246 if (m_children & Slots)
247 m_slots->write(writer, u"slots"_s);
249 if (m_children & ButtonGroups)
250 m_buttonGroups->write(writer, u"buttongroups"_s);
252 writer.writeEndElement();
599void DomInclude::read(QXmlStreamReader &reader)
601 const QXmlStreamAttributes &attributes = reader.attributes();
602 for (
const QXmlStreamAttribute &attribute : attributes) {
603 const auto name = attribute.name();
604 if (name == u"location"_s) {
605 setAttributeLocation(attribute.value().toString());
608 if (name == u"impldecl"_s) {
609 setAttributeImpldecl(attribute.value().toString());
612 reader.raiseError(
"Unexpected attribute "_L1 + name);
615 while (!reader.hasError()) {
616 switch (reader.readNext()) {
617 case QXmlStreamReader::StartElement : {
618 const auto tag = reader.name();
619 reader.raiseError(
"Unexpected element "_L1 + tag);
622 case QXmlStreamReader::EndElement :
624 case QXmlStreamReader::Characters :
625 if (!reader.isWhitespace())
626 m_text.append(reader.text().toString());
759void DomActionGroup::read(QXmlStreamReader &reader)
761 const QXmlStreamAttributes &attributes = reader.attributes();
762 for (
const QXmlStreamAttribute &attribute : attributes) {
763 const auto name = attribute.name();
764 if (name == u"name"_s) {
765 setAttributeName(attribute.value().toString());
768 reader.raiseError(
"Unexpected attribute "_L1 + name);
771 while (!reader.hasError()) {
772 switch (reader.readNext()) {
773 case QXmlStreamReader::StartElement : {
774 const auto tag = reader.name();
775 if (!tag.compare(u"action"_s, Qt::CaseInsensitive)) {
776 auto *v =
new DomAction();
781 if (!tag.compare(u"actiongroup"_s, Qt::CaseInsensitive)) {
782 auto *v =
new DomActionGroup();
784 m_actionGroup.append(v);
787 if (!tag.compare(u"property"_s, Qt::CaseInsensitive)) {
788 auto *v =
new DomProperty();
790 m_property.append(v);
793 if (!tag.compare(u"attribute"_s, Qt::CaseInsensitive)) {
794 auto *v =
new DomProperty();
796 m_attribute.append(v);
799 reader.raiseError(
"Unexpected element "_L1 + tag);
802 case QXmlStreamReader::EndElement :
810void DomActionGroup::write(QXmlStreamWriter &writer,
const QString &tagName)
const
812 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral(
"actiongroup") : tagName.toLower());
814 if (hasAttributeName())
815 writer.writeAttribute(u"name"_s, attributeName());
817 for (DomAction *v : m_action)
818 v->write(writer, u"action"_s);
820 for (DomActionGroup *v : m_actionGroup)
821 v->write(writer, u"actiongroup"_s);
823 for (DomProperty *v : m_property)
824 v->write(writer, u"property"_s);
826 for (DomProperty *v : m_attribute)
827 v->write(writer, u"attribute"_s);
829 writer.writeEndElement();
907void DomAction::write(QXmlStreamWriter &writer,
const QString &tagName)
const
909 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral(
"action") : tagName.toLower());
911 if (hasAttributeName())
912 writer.writeAttribute(u"name"_s, attributeName());
914 if (hasAttributeMenu())
915 writer.writeAttribute(u"menu"_s, attributeMenu());
917 for (DomProperty *v : m_property)
918 v->write(writer, u"property"_s);
920 for (DomProperty *v : m_attribute)
921 v->write(writer, u"attribute"_s);
923 writer.writeEndElement();
1196void DomCustomWidget::read(QXmlStreamReader &reader)
1198 while (!reader.hasError()) {
1199 switch (reader.readNext()) {
1200 case QXmlStreamReader::StartElement : {
1201 const auto tag = reader.name();
1202 if (!tag.compare(u"class"_s, Qt::CaseInsensitive)) {
1203 setElementClass(reader.readElementText());
1206 if (!tag.compare(u"extends"_s, Qt::CaseInsensitive)) {
1207 setElementExtends(reader.readElementText());
1210 if (!tag.compare(u"header"_s, Qt::CaseInsensitive)) {
1211 auto *v =
new DomHeader();
1213 setElementHeader(v);
1216 if (!tag.compare(u"sizehint"_s, Qt::CaseInsensitive)) {
1217 auto *v =
new DomSize();
1219 setElementSizeHint(v);
1222 if (!tag.compare(u"addpagemethod"_s, Qt::CaseInsensitive)) {
1223 setElementAddPageMethod(reader.readElementText());
1226 if (!tag.compare(u"container"_s, Qt::CaseInsensitive)) {
1227 setElementContainer(reader.readElementText().toInt());
1230 if (!tag.compare(u"sizepolicy"_s, Qt::CaseInsensitive)) {
1231 qWarning(
"Omitting deprecated element <sizepolicy>.");
1232 reader.skipCurrentElement();
1235 if (!tag.compare(u"pixmap"_s, Qt::CaseInsensitive)) {
1236 setElementPixmap(reader.readElementText());
1239 if (!tag.compare(u"script"_s, Qt::CaseInsensitive)) {
1240 qWarning(
"Omitting deprecated element <script>.");
1241 reader.skipCurrentElement();
1244 if (!tag.compare(u"properties"_s, Qt::CaseInsensitive)) {
1245 qWarning(
"Omitting deprecated element <properties>.");
1246 reader.skipCurrentElement();
1249 if (!tag.compare(u"slots"_s, Qt::CaseInsensitive)) {
1250 auto *v =
new DomSlots();
1255 if (!tag.compare(u"propertyspecifications"_s, Qt::CaseInsensitive)) {
1256 auto *v =
new DomPropertySpecifications();
1258 setElementPropertyspecifications(v);
1261 reader.raiseError(
"Unexpected element "_L1 + tag);
1264 case QXmlStreamReader::EndElement :
1272void DomCustomWidget::write(QXmlStreamWriter &writer,
const QString &tagName)
const
1274 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral(
"customwidget") : tagName.toLower());
1276 if (m_children & Class)
1277 writer.writeTextElement(u"class"_s, m_class);
1279 if (m_children & Extends)
1280 writer.writeTextElement(u"extends"_s, m_extends);
1282 if (m_children & Header)
1283 m_header->write(writer, u"header"_s);
1285 if (m_children & SizeHint)
1286 m_sizeHint->write(writer, u"sizehint"_s);
1288 if (m_children & AddPageMethod)
1289 writer.writeTextElement(u"addpagemethod"_s, m_addPageMethod);
1291 if (m_children & Container)
1292 writer.writeTextElement(u"container"_s, QString::number(m_container));
1294 if (m_children & Pixmap)
1295 writer.writeTextElement(u"pixmap"_s, m_pixmap);
1297 if (m_children & Slots)
1298 m_slots->write(writer, u"slots"_s);
1300 if (m_children & Propertyspecifications)
1301 m_propertyspecifications->write(writer, u"propertyspecifications"_s);
1303 writer.writeEndElement();
1593void DomLayout::read(QXmlStreamReader &reader)
1595 const QXmlStreamAttributes &attributes = reader.attributes();
1596 for (
const QXmlStreamAttribute &attribute : attributes) {
1597 const auto name = attribute.name();
1598 if (name == u"class"_s) {
1599 setAttributeClass(attribute.value().toString());
1602 if (name == u"name"_s) {
1603 setAttributeName(attribute.value().toString());
1606 if (name == u"stretch"_s) {
1607 setAttributeStretch(attribute.value().toString());
1610 if (name == u"rowstretch"_s) {
1611 setAttributeRowStretch(attribute.value().toString());
1614 if (name == u"columnstretch"_s) {
1615 setAttributeColumnStretch(attribute.value().toString());
1618 if (name == u"rowminimumheight"_s) {
1619 setAttributeRowMinimumHeight(attribute.value().toString());
1622 if (name == u"columnminimumwidth"_s) {
1623 setAttributeColumnMinimumWidth(attribute.value().toString());
1626 reader.raiseError(
"Unexpected attribute "_L1 + name);
1629 while (!reader.hasError()) {
1630 switch (reader.readNext()) {
1631 case QXmlStreamReader::StartElement : {
1632 const auto tag = reader.name();
1633 if (!tag.compare(u"property"_s, Qt::CaseInsensitive)) {
1634 auto *v =
new DomProperty();
1636 m_property.append(v);
1639 if (!tag.compare(u"attribute"_s, Qt::CaseInsensitive)) {
1640 auto *v =
new DomProperty();
1642 m_attribute.append(v);
1645 if (!tag.compare(u"item"_s, Qt::CaseInsensitive)) {
1646 auto *v =
new DomLayoutItem();
1651 reader.raiseError(
"Unexpected element "_L1 + tag);
1654 case QXmlStreamReader::EndElement :
1662void DomLayout::write(QXmlStreamWriter &writer,
const QString &tagName)
const
1664 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral(
"layout") : tagName.toLower());
1666 if (hasAttributeClass())
1667 writer.writeAttribute(u"class"_s, attributeClass());
1669 if (hasAttributeName())
1670 writer.writeAttribute(u"name"_s, attributeName());
1672 if (hasAttributeStretch())
1673 writer.writeAttribute(u"stretch"_s, attributeStretch());
1675 if (hasAttributeRowStretch())
1676 writer.writeAttribute(u"rowstretch"_s, attributeRowStretch());
1678 if (hasAttributeColumnStretch())
1679 writer.writeAttribute(u"columnstretch"_s, attributeColumnStretch());
1681 if (hasAttributeRowMinimumHeight())
1682 writer.writeAttribute(u"rowminimumheight"_s, attributeRowMinimumHeight());
1684 if (hasAttributeColumnMinimumWidth())
1685 writer.writeAttribute(u"columnminimumwidth"_s, attributeColumnMinimumWidth());
1687 for (DomProperty *v : m_property)
1688 v->write(writer, u"property"_s);
1690 for (DomProperty *v : m_attribute)
1691 v->write(writer, u"attribute"_s);
1693 for (DomLayoutItem *v : m_item)
1694 v->write(writer, u"item"_s);
1696 writer.writeEndElement();
1737void DomLayoutItem::read(QXmlStreamReader &reader)
1739 const QXmlStreamAttributes &attributes = reader.attributes();
1740 for (
const QXmlStreamAttribute &attribute : attributes) {
1741 const auto name = attribute.name();
1742 if (name == u"row"_s) {
1743 setAttributeRow(attribute.value().toInt());
1746 if (name == u"column"_s) {
1747 setAttributeColumn(attribute.value().toInt());
1750 if (name == u"rowspan"_s) {
1751 setAttributeRowSpan(attribute.value().toInt());
1754 if (name == u"colspan"_s) {
1755 setAttributeColSpan(attribute.value().toInt());
1758 if (name == u"alignment"_s) {
1759 setAttributeAlignment(attribute.value().toString());
1762 reader.raiseError(
"Unexpected attribute "_L1 + name);
1765 while (!reader.hasError()) {
1766 switch (reader.readNext()) {
1767 case QXmlStreamReader::StartElement : {
1768 const auto tag = reader.name();
1769 if (!tag.compare(u"widget"_s, Qt::CaseInsensitive)) {
1770 auto *v =
new DomWidget();
1772 setElementWidget(v);
1775 if (!tag.compare(u"layout"_s, Qt::CaseInsensitive)) {
1776 auto *v =
new DomLayout();
1778 setElementLayout(v);
1781 if (!tag.compare(u"spacer"_s, Qt::CaseInsensitive)) {
1782 auto *v =
new DomSpacer();
1784 setElementSpacer(v);
1787 reader.raiseError(
"Unexpected element "_L1 + tag);
1790 case QXmlStreamReader::EndElement :
1798void DomLayoutItem::write(QXmlStreamWriter &writer,
const QString &tagName)
const
1800 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral(
"layoutitem") : tagName.toLower());
1802 if (hasAttributeRow())
1803 writer.writeAttribute(u"row"_s, QString::number(attributeRow()));
1805 if (hasAttributeColumn())
1806 writer.writeAttribute(u"column"_s, QString::number(attributeColumn()));
1808 if (hasAttributeRowSpan())
1809 writer.writeAttribute(u"rowspan"_s, QString::number(attributeRowSpan()));
1811 if (hasAttributeColSpan())
1812 writer.writeAttribute(u"colspan"_s, QString::number(attributeColSpan()));
1814 if (hasAttributeAlignment())
1815 writer.writeAttribute(u"alignment"_s, attributeAlignment());
1819 if (m_widget !=
nullptr)
1820 m_widget->write(writer, u"widget"_s);
1824 if (m_layout !=
nullptr)
1825 m_layout->write(writer, u"layout"_s);
1829 if (m_spacer !=
nullptr)
1830 m_spacer->write(writer, u"spacer"_s);
1836 writer.writeEndElement();
2079void DomWidget::read(QXmlStreamReader &reader)
2081 const QXmlStreamAttributes &attributes = reader.attributes();
2082 for (
const QXmlStreamAttribute &attribute : attributes) {
2083 const auto name = attribute.name();
2084 if (name == u"class"_s) {
2085 setAttributeClass(attribute.value().toString());
2088 if (name == u"name"_s) {
2089 setAttributeName(attribute.value().toString());
2092 if (name == u"native"_s) {
2093 setAttributeNative(attribute.value() == u"true"_s);
2096 reader.raiseError(
"Unexpected attribute "_L1 + name);
2099 while (!reader.hasError()) {
2100 switch (reader.readNext()) {
2101 case QXmlStreamReader::StartElement : {
2102 const auto tag = reader.name();
2103 if (!tag.compare(u"class"_s, Qt::CaseInsensitive)) {
2104 m_class.append(reader.readElementText());
2107 if (!tag.compare(u"property"_s, Qt::CaseInsensitive)) {
2108 auto *v =
new DomProperty();
2110 m_property.append(v);
2113 if (!tag.compare(u"script"_s, Qt::CaseInsensitive)) {
2114 qWarning(
"Omitting deprecated element <script>.");
2115 reader.skipCurrentElement();
2118 if (!tag.compare(u"widgetdata"_s, Qt::CaseInsensitive)) {
2119 qWarning(
"Omitting deprecated element <widgetdata>.");
2120 reader.skipCurrentElement();
2123 if (!tag.compare(u"attribute"_s, Qt::CaseInsensitive)) {
2124 auto *v =
new DomProperty();
2126 m_attribute.append(v);
2129 if (!tag.compare(u"row"_s, Qt::CaseInsensitive)) {
2130 auto *v =
new DomRow();
2135 if (!tag.compare(u"column"_s, Qt::CaseInsensitive)) {
2136 auto *v =
new DomColumn();
2141 if (!tag.compare(u"item"_s, Qt::CaseInsensitive)) {
2142 auto *v =
new DomItem();
2147 if (!tag.compare(u"layout"_s, Qt::CaseInsensitive)) {
2148 auto *v =
new DomLayout();
2153 if (!tag.compare(u"widget"_s, Qt::CaseInsensitive)) {
2154 auto *v =
new DomWidget();
2159 if (!tag.compare(u"action"_s, Qt::CaseInsensitive)) {
2160 auto *v =
new DomAction();
2165 if (!tag.compare(u"actiongroup"_s, Qt::CaseInsensitive)) {
2166 auto *v =
new DomActionGroup();
2168 m_actionGroup.append(v);
2171 if (!tag.compare(u"addaction"_s, Qt::CaseInsensitive)) {
2172 auto *v =
new DomActionRef();
2174 m_addAction.append(v);
2177 if (!tag.compare(u"zorder"_s, Qt::CaseInsensitive)) {
2178 m_zOrder.append(reader.readElementText());
2181 reader.raiseError(
"Unexpected element "_L1 + tag);
2184 case QXmlStreamReader::EndElement :
2192void DomWidget::write(QXmlStreamWriter &writer,
const QString &tagName)
const
2194 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral(
"widget") : tagName.toLower());
2196 if (hasAttributeClass())
2197 writer.writeAttribute(u"class"_s, attributeClass());
2199 if (hasAttributeName())
2200 writer.writeAttribute(u"name"_s, attributeName());
2202 if (hasAttributeNative())
2203 writer.writeAttribute(u"native"_s, (attributeNative() ? u"true"_s : u"false"_s));
2205 for (
const QString &v : m_class)
2206 writer.writeTextElement(u"class"_s, v);
2208 for (DomProperty *v : m_property)
2209 v->write(writer, u"property"_s);
2211 for (DomProperty *v : m_attribute)
2212 v->write(writer, u"attribute"_s);
2214 for (DomRow *v : m_row)
2215 v->write(writer, u"row"_s);
2217 for (DomColumn *v : m_column)
2218 v->write(writer, u"column"_s);
2220 for (DomItem *v : m_item)
2221 v->write(writer, u"item"_s);
2223 for (DomLayout *v : m_layout)
2224 v->write(writer, u"layout"_s);
2226 for (DomWidget *v : m_widget)
2227 v->write(writer, u"widget"_s);
2229 for (DomAction *v : m_action)
2230 v->write(writer, u"action"_s);
2232 for (DomActionGroup *v : m_actionGroup)
2233 v->write(writer, u"actiongroup"_s);
2235 for (DomActionRef *v : m_addAction)
2236 v->write(writer, u"addaction"_s);
2238 for (
const QString &v : m_zOrder)
2239 writer.writeTextElement(u"zorder"_s, v);
2241 writer.writeEndElement();
2376void DomColor::read(QXmlStreamReader &reader)
2378 const QXmlStreamAttributes &attributes = reader.attributes();
2379 for (
const QXmlStreamAttribute &attribute : attributes) {
2380 const auto name = attribute.name();
2381 if (name == u"alpha"_s) {
2382 setAttributeAlpha(attribute.value().toInt());
2385 reader.raiseError(
"Unexpected attribute "_L1 + name);
2388 while (!reader.hasError()) {
2389 switch (reader.readNext()) {
2390 case QXmlStreamReader::StartElement : {
2391 const auto tag = reader.name();
2392 if (!tag.compare(u"red"_s, Qt::CaseInsensitive)) {
2393 setElementRed(reader.readElementText().toInt());
2396 if (!tag.compare(u"green"_s, Qt::CaseInsensitive)) {
2397 setElementGreen(reader.readElementText().toInt());
2400 if (!tag.compare(u"blue"_s, Qt::CaseInsensitive)) {
2401 setElementBlue(reader.readElementText().toInt());
2404 reader.raiseError(
"Unexpected element "_L1 + tag);
2407 case QXmlStreamReader::EndElement :
2546void DomGradient::read(QXmlStreamReader &reader)
2548 const QXmlStreamAttributes &attributes = reader.attributes();
2549 for (
const QXmlStreamAttribute &attribute : attributes) {
2550 const auto name = attribute.name();
2551 if (name == u"startx"_s) {
2552 setAttributeStartX(attribute.value().toDouble());
2555 if (name == u"starty"_s) {
2556 setAttributeStartY(attribute.value().toDouble());
2559 if (name == u"endx"_s) {
2560 setAttributeEndX(attribute.value().toDouble());
2563 if (name == u"endy"_s) {
2564 setAttributeEndY(attribute.value().toDouble());
2567 if (name == u"centralx"_s) {
2568 setAttributeCentralX(attribute.value().toDouble());
2571 if (name == u"centraly"_s) {
2572 setAttributeCentralY(attribute.value().toDouble());
2575 if (name == u"focalx"_s) {
2576 setAttributeFocalX(attribute.value().toDouble());
2579 if (name == u"focaly"_s) {
2580 setAttributeFocalY(attribute.value().toDouble());
2583 if (name == u"radius"_s) {
2584 setAttributeRadius(attribute.value().toDouble());
2587 if (name == u"angle"_s) {
2588 setAttributeAngle(attribute.value().toDouble());
2591 if (name == u"type"_s) {
2592 setAttributeType(attribute.value().toString());
2595 if (name == u"spread"_s) {
2596 setAttributeSpread(attribute.value().toString());
2599 if (name == u"coordinatemode"_s) {
2600 setAttributeCoordinateMode(attribute.value().toString());
2603 reader.raiseError(
"Unexpected attribute "_L1 + name);
2606 while (!reader.hasError()) {
2607 switch (reader.readNext()) {
2608 case QXmlStreamReader::StartElement : {
2609 const auto tag = reader.name();
2610 if (!tag.compare(u"gradientstop"_s, Qt::CaseInsensitive)) {
2611 auto *v =
new DomGradientStop();
2613 m_gradientStop.append(v);
2616 reader.raiseError(
"Unexpected element "_L1 + tag);
2619 case QXmlStreamReader::EndElement :
2627void DomGradient::write(QXmlStreamWriter &writer,
const QString &tagName)
const
2629 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral(
"gradient") : tagName.toLower());
2631 if (hasAttributeStartX())
2632 writer.writeAttribute(u"startx"_s, QString::number(attributeStartX(),
'f', 15));
2634 if (hasAttributeStartY())
2635 writer.writeAttribute(u"starty"_s, QString::number(attributeStartY(),
'f', 15));
2637 if (hasAttributeEndX())
2638 writer.writeAttribute(u"endx"_s, QString::number(attributeEndX(),
'f', 15));
2640 if (hasAttributeEndY())
2641 writer.writeAttribute(u"endy"_s, QString::number(attributeEndY(),
'f', 15));
2643 if (hasAttributeCentralX())
2644 writer.writeAttribute(u"centralx"_s, QString::number(attributeCentralX(),
'f', 15));
2646 if (hasAttributeCentralY())
2647 writer.writeAttribute(u"centraly"_s, QString::number(attributeCentralY(),
'f', 15));
2649 if (hasAttributeFocalX())
2650 writer.writeAttribute(u"focalx"_s, QString::number(attributeFocalX(),
'f', 15));
2652 if (hasAttributeFocalY())
2653 writer.writeAttribute(u"focaly"_s, QString::number(attributeFocalY(),
'f', 15));
2655 if (hasAttributeRadius())
2656 writer.writeAttribute(u"radius"_s, QString::number(attributeRadius(),
'f', 15));
2658 if (hasAttributeAngle())
2659 writer.writeAttribute(u"angle"_s, QString::number(attributeAngle(),
'f', 15));
2661 if (hasAttributeType())
2662 writer.writeAttribute(u"type"_s, attributeType());
2664 if (hasAttributeSpread())
2665 writer.writeAttribute(u"spread"_s, attributeSpread());
2667 if (hasAttributeCoordinateMode())
2668 writer.writeAttribute(u"coordinatemode"_s, attributeCoordinateMode());
2670 for (DomGradientStop *v : m_gradientStop)
2671 v->write(writer, u"gradientstop"_s);
2673 writer.writeEndElement();
2702void DomBrush::read(QXmlStreamReader &reader)
2704 const QXmlStreamAttributes &attributes = reader.attributes();
2705 for (
const QXmlStreamAttribute &attribute : attributes) {
2706 const auto name = attribute.name();
2707 if (name == u"brushstyle"_s) {
2708 setAttributeBrushStyle(attribute.value().toString());
2711 reader.raiseError(
"Unexpected attribute "_L1 + name);
2714 while (!reader.hasError()) {
2715 switch (reader.readNext()) {
2716 case QXmlStreamReader::StartElement : {
2717 const auto tag = reader.name();
2718 if (!tag.compare(u"color"_s, Qt::CaseInsensitive)) {
2719 auto *v =
new DomColor();
2724 if (!tag.compare(u"texture"_s, Qt::CaseInsensitive)) {
2725 auto *v =
new DomProperty();
2727 setElementTexture(v);
2730 if (!tag.compare(u"gradient"_s, Qt::CaseInsensitive)) {
2731 auto *v =
new DomGradient();
2733 setElementGradient(v);
2736 reader.raiseError(
"Unexpected element "_L1 + tag);
2739 case QXmlStreamReader::EndElement :
3079void DomFont::read(QXmlStreamReader &reader)
3081 while (!reader.hasError()) {
3082 switch (reader.readNext()) {
3083 case QXmlStreamReader::StartElement : {
3084 const auto tag = reader.name();
3085 if (!tag.compare(u"family"_s, Qt::CaseInsensitive)) {
3086 setElementFamily(reader.readElementText());
3089 if (!tag.compare(u"pointsize"_s, Qt::CaseInsensitive)) {
3090 setElementPointSize(reader.readElementText().toInt());
3093 if (!tag.compare(u"weight"_s, Qt::CaseInsensitive)) {
3094 setElementWeight(reader.readElementText().toInt());
3097 if (!tag.compare(u"italic"_s, Qt::CaseInsensitive)) {
3098 setElementItalic(reader.readElementText() == u"true"_s);
3101 if (!tag.compare(u"bold"_s, Qt::CaseInsensitive)) {
3102 setElementBold(reader.readElementText() == u"true"_s);
3105 if (!tag.compare(u"underline"_s, Qt::CaseInsensitive)) {
3106 setElementUnderline(reader.readElementText() == u"true"_s);
3109 if (!tag.compare(u"strikeout"_s, Qt::CaseInsensitive)) {
3110 setElementStrikeOut(reader.readElementText() == u"true"_s);
3113 if (!tag.compare(u"antialiasing"_s, Qt::CaseInsensitive)) {
3114 setElementAntialiasing(reader.readElementText() == u"true"_s);
3117 if (!tag.compare(u"stylestrategy"_s, Qt::CaseInsensitive)) {
3118 setElementStyleStrategy(reader.readElementText());
3121 if (!tag.compare(u"kerning"_s, Qt::CaseInsensitive)) {
3122 setElementKerning(reader.readElementText() == u"true"_s);
3125 if (!tag.compare(u"hintingpreference"_s, Qt::CaseInsensitive)) {
3126 setElementHintingPreference(reader.readElementText());
3129 if (!tag.compare(u"fontweight"_s, Qt::CaseInsensitive)) {
3130 setElementFontWeight(reader.readElementText());
3133 reader.raiseError(
"Unexpected element "_L1 + tag);
3136 case QXmlStreamReader::EndElement :
3144void DomFont::write(QXmlStreamWriter &writer,
const QString &tagName)
const
3146 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral(
"font") : tagName.toLower());
3148 if (m_children & Family)
3149 writer.writeTextElement(u"family"_s, m_family);
3151 if (m_children & PointSize)
3152 writer.writeTextElement(u"pointsize"_s, QString::number(m_pointSize));
3154 if (m_children & Weight)
3155 writer.writeTextElement(u"weight"_s, QString::number(m_weight));
3157 if (m_children & Italic)
3158 writer.writeTextElement(u"italic"_s, (m_italic ? u"true"_s : u"false"_s));
3160 if (m_children & Bold)
3161 writer.writeTextElement(u"bold"_s, (m_bold ? u"true"_s : u"false"_s));
3163 if (m_children & Underline)
3164 writer.writeTextElement(u"underline"_s, (m_underline ? u"true"_s : u"false"_s));
3166 if (m_children & StrikeOut)
3167 writer.writeTextElement(u"strikeout"_s, (m_strikeOut ? u"true"_s : u"false"_s));
3169 if (m_children & Antialiasing)
3170 writer.writeTextElement(u"antialiasing"_s, (m_antialiasing ? u"true"_s : u"false"_s));
3172 if (m_children & StyleStrategy)
3173 writer.writeTextElement(u"stylestrategy"_s, m_styleStrategy);
3175 if (m_children & Kerning)
3176 writer.writeTextElement(u"kerning"_s, (m_kerning ? u"true"_s : u"false"_s));
3178 if (m_children & HintingPreference)
3179 writer.writeTextElement(u"hintingpreference"_s, m_hintingPreference);
3181 if (m_children & FontWeight)
3182 writer.writeTextElement(u"fontweight"_s, m_fontWeight);
3184 writer.writeEndElement();
3383void DomRect::read(QXmlStreamReader &reader)
3385 while (!reader.hasError()) {
3386 switch (reader.readNext()) {
3387 case QXmlStreamReader::StartElement : {
3388 const auto tag = reader.name();
3389 if (!tag.compare(u"x"_s, Qt::CaseInsensitive)) {
3390 setElementX(reader.readElementText().toInt());
3393 if (!tag.compare(u"y"_s, Qt::CaseInsensitive)) {
3394 setElementY(reader.readElementText().toInt());
3397 if (!tag.compare(u"width"_s, Qt::CaseInsensitive)) {
3398 setElementWidth(reader.readElementText().toInt());
3401 if (!tag.compare(u"height"_s, Qt::CaseInsensitive)) {
3402 setElementHeight(reader.readElementText().toInt());
3405 reader.raiseError(
"Unexpected element "_L1 + tag);
3408 case QXmlStreamReader::EndElement :
3527void DomSizePolicy::read(QXmlStreamReader &reader)
3529 const QXmlStreamAttributes &attributes = reader.attributes();
3530 for (
const QXmlStreamAttribute &attribute : attributes) {
3531 const auto name = attribute.name();
3532 if (name == u"hsizetype"_s) {
3533 setAttributeHSizeType(attribute.value().toString());
3536 if (name == u"vsizetype"_s) {
3537 setAttributeVSizeType(attribute.value().toString());
3540 reader.raiseError(
"Unexpected attribute "_L1 + name);
3543 while (!reader.hasError()) {
3544 switch (reader.readNext()) {
3545 case QXmlStreamReader::StartElement : {
3546 const auto tag = reader.name();
3547 if (!tag.compare(u"hsizetype"_s, Qt::CaseInsensitive)) {
3548 setElementHSizeType(reader.readElementText().toInt());
3551 if (!tag.compare(u"vsizetype"_s, Qt::CaseInsensitive)) {
3552 setElementVSizeType(reader.readElementText().toInt());
3555 if (!tag.compare(u"horstretch"_s, Qt::CaseInsensitive)) {
3556 setElementHorStretch(reader.readElementText().toInt());
3559 if (!tag.compare(u"verstretch"_s, Qt::CaseInsensitive)) {
3560 setElementVerStretch(reader.readElementText().toInt());
3563 reader.raiseError(
"Unexpected element "_L1 + tag);
3566 case QXmlStreamReader::EndElement :
3574void DomSizePolicy::write(QXmlStreamWriter &writer,
const QString &tagName)
const
3576 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral(
"sizepolicy") : tagName.toLower());
3578 if (hasAttributeHSizeType())
3579 writer.writeAttribute(u"hsizetype"_s, attributeHSizeType());
3581 if (hasAttributeVSizeType())
3582 writer.writeAttribute(u"vsizetype"_s, attributeVSizeType());
3584 if (m_children & HSizeType)
3585 writer.writeTextElement(u"hsizetype"_s, QString::number(m_hSizeType));
3587 if (m_children & VSizeType)
3588 writer.writeTextElement(u"vsizetype"_s, QString::number(m_vSizeType));
3590 if (m_children & HorStretch)
3591 writer.writeTextElement(u"horstretch"_s, QString::number(m_horStretch));
3593 if (m_children & VerStretch)
3594 writer.writeTextElement(u"verstretch"_s, QString::number(m_verStretch));
3596 writer.writeEndElement();
3707void DomDate::read(QXmlStreamReader &reader)
3709 while (!reader.hasError()) {
3710 switch (reader.readNext()) {
3711 case QXmlStreamReader::StartElement : {
3712 const auto tag = reader.name();
3713 if (!tag.compare(u"year"_s, Qt::CaseInsensitive)) {
3714 setElementYear(reader.readElementText().toInt());
3717 if (!tag.compare(u"month"_s, Qt::CaseInsensitive)) {
3718 setElementMonth(reader.readElementText().toInt());
3721 if (!tag.compare(u"day"_s, Qt::CaseInsensitive)) {
3722 setElementDay(reader.readElementText().toInt());
3725 reader.raiseError(
"Unexpected element "_L1 + tag);
3728 case QXmlStreamReader::EndElement :
3787void DomTime::read(QXmlStreamReader &reader)
3789 while (!reader.hasError()) {
3790 switch (reader.readNext()) {
3791 case QXmlStreamReader::StartElement : {
3792 const auto tag = reader.name();
3793 if (!tag.compare(u"hour"_s, Qt::CaseInsensitive)) {
3794 setElementHour(reader.readElementText().toInt());
3797 if (!tag.compare(u"minute"_s, Qt::CaseInsensitive)) {
3798 setElementMinute(reader.readElementText().toInt());
3801 if (!tag.compare(u"second"_s, Qt::CaseInsensitive)) {
3802 setElementSecond(reader.readElementText().toInt());
3805 reader.raiseError(
"Unexpected element "_L1 + tag);
3808 case QXmlStreamReader::EndElement :
3867void DomDateTime::read(QXmlStreamReader &reader)
3869 while (!reader.hasError()) {
3870 switch (reader.readNext()) {
3871 case QXmlStreamReader::StartElement : {
3872 const auto tag = reader.name();
3873 if (!tag.compare(u"hour"_s, Qt::CaseInsensitive)) {
3874 setElementHour(reader.readElementText().toInt());
3877 if (!tag.compare(u"minute"_s, Qt::CaseInsensitive)) {
3878 setElementMinute(reader.readElementText().toInt());
3881 if (!tag.compare(u"second"_s, Qt::CaseInsensitive)) {
3882 setElementSecond(reader.readElementText().toInt());
3885 if (!tag.compare(u"year"_s, Qt::CaseInsensitive)) {
3886 setElementYear(reader.readElementText().toInt());
3889 if (!tag.compare(u"month"_s, Qt::CaseInsensitive)) {
3890 setElementMonth(reader.readElementText().toInt());
3893 if (!tag.compare(u"day"_s, Qt::CaseInsensitive)) {
3894 setElementDay(reader.readElementText().toInt());
3897 reader.raiseError(
"Unexpected element "_L1 + tag);
3900 case QXmlStreamReader::EndElement :
3908void DomDateTime::write(QXmlStreamWriter &writer,
const QString &tagName)
const
3910 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral(
"datetime") : tagName.toLower());
3912 if (m_children & Hour)
3913 writer.writeTextElement(u"hour"_s, QString::number(m_hour));
3915 if (m_children & Minute)
3916 writer.writeTextElement(u"minute"_s, QString::number(m_minute));
3918 if (m_children & Second)
3919 writer.writeTextElement(u"second"_s, QString::number(m_second));
3921 if (m_children & Year)
3922 writer.writeTextElement(u"year"_s, QString::number(m_year));
3924 if (m_children & Month)
3925 writer.writeTextElement(u"month"_s, QString::number(m_month));
3927 if (m_children & Day)
3928 writer.writeTextElement(u"day"_s, QString::number(m_day));
3930 writer.writeEndElement();
4004void DomStringList::read(QXmlStreamReader &reader)
4006 const QXmlStreamAttributes &attributes = reader.attributes();
4007 for (
const QXmlStreamAttribute &attribute : attributes) {
4008 const auto name = attribute.name();
4009 if (name == u"notr"_s) {
4010 setAttributeNotr(attribute.value().toString());
4013 if (name == u"comment"_s) {
4014 setAttributeComment(attribute.value().toString());
4017 if (name == u"extracomment"_s) {
4018 setAttributeExtraComment(attribute.value().toString());
4021 if (name == u"id"_s) {
4022 setAttributeId(attribute.value().toString());
4025 reader.raiseError(
"Unexpected attribute "_L1 + name);
4028 while (!reader.hasError()) {
4029 switch (reader.readNext()) {
4030 case QXmlStreamReader::StartElement : {
4031 const auto tag = reader.name();
4032 if (!tag.compare(u"string"_s, Qt::CaseInsensitive)) {
4033 m_string.append(reader.readElementText());
4036 reader.raiseError(
"Unexpected element "_L1 + tag);
4039 case QXmlStreamReader::EndElement :
4047void DomStringList::write(QXmlStreamWriter &writer,
const QString &tagName)
const
4049 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral(
"stringlist") : tagName.toLower());
4051 if (hasAttributeNotr())
4052 writer.writeAttribute(u"notr"_s, attributeNotr());
4054 if (hasAttributeComment())
4055 writer.writeAttribute(u"comment"_s, attributeComment());
4057 if (hasAttributeExtraComment())
4058 writer.writeAttribute(u"extracomment"_s, attributeExtraComment());
4060 if (hasAttributeId())
4061 writer.writeAttribute(u"id"_s, attributeId());
4063 for (
const QString &v : m_string)
4064 writer.writeTextElement(u"string"_s, v);
4066 writer.writeEndElement();
4140void DomResourceIcon::read(QXmlStreamReader &reader)
4142 const QXmlStreamAttributes &attributes = reader.attributes();
4143 for (
const QXmlStreamAttribute &attribute : attributes) {
4144 const auto name = attribute.name();
4145 if (name == u"theme"_s) {
4146 setAttributeTheme(attribute.value().toString());
4149 if (name == u"resource"_s) {
4150 setAttributeResource(attribute.value().toString());
4153 reader.raiseError(
"Unexpected attribute "_L1 + name);
4156 while (!reader.hasError()) {
4157 switch (reader.readNext()) {
4158 case QXmlStreamReader::StartElement : {
4159 const auto tag = reader.name();
4160 if (!tag.compare(u"normaloff"_s, Qt::CaseInsensitive)) {
4161 auto *v =
new DomResourcePixmap();
4163 setElementNormalOff(v);
4166 if (!tag.compare(u"normalon"_s, Qt::CaseInsensitive)) {
4167 auto *v =
new DomResourcePixmap();
4169 setElementNormalOn(v);
4172 if (!tag.compare(u"disabledoff"_s, Qt::CaseInsensitive)) {
4173 auto *v =
new DomResourcePixmap();
4175 setElementDisabledOff(v);
4178 if (!tag.compare(u"disabledon"_s, Qt::CaseInsensitive)) {
4179 auto *v =
new DomResourcePixmap();
4181 setElementDisabledOn(v);
4184 if (!tag.compare(u"activeoff"_s, Qt::CaseInsensitive)) {
4185 auto *v =
new DomResourcePixmap();
4187 setElementActiveOff(v);
4190 if (!tag.compare(u"activeon"_s, Qt::CaseInsensitive)) {
4191 auto *v =
new DomResourcePixmap();
4193 setElementActiveOn(v);
4196 if (!tag.compare(u"selectedoff"_s, Qt::CaseInsensitive)) {
4197 auto *v =
new DomResourcePixmap();
4199 setElementSelectedOff(v);
4202 if (!tag.compare(u"selectedon"_s, Qt::CaseInsensitive)) {
4203 auto *v =
new DomResourcePixmap();
4205 setElementSelectedOn(v);
4208 reader.raiseError(
"Unexpected element "_L1 + tag);
4211 case QXmlStreamReader::EndElement :
4213 case QXmlStreamReader::Characters :
4214 if (!reader.isWhitespace())
4215 m_text.append(reader.text().toString());
4223void DomResourceIcon::write(QXmlStreamWriter &writer,
const QString &tagName)
const
4225 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral(
"resourceicon") : tagName.toLower());
4227 if (hasAttributeTheme())
4228 writer.writeAttribute(u"theme"_s, attributeTheme());
4230 if (hasAttributeResource())
4231 writer.writeAttribute(u"resource"_s, attributeResource());
4233 if (m_children & NormalOff)
4234 m_normalOff->write(writer, u"normaloff"_s);
4236 if (m_children & NormalOn)
4237 m_normalOn->write(writer, u"normalon"_s);
4239 if (m_children & DisabledOff)
4240 m_disabledOff->write(writer, u"disabledoff"_s);
4242 if (m_children & DisabledOn)
4243 m_disabledOn->write(writer, u"disabledon"_s);
4245 if (m_children & ActiveOff)
4246 m_activeOff->write(writer, u"activeoff"_s);
4248 if (m_children & ActiveOn)
4249 m_activeOn->write(writer, u"activeon"_s);
4251 if (m_children & SelectedOff)
4252 m_selectedOff->write(writer, u"selectedoff"_s);
4254 if (m_children & SelectedOn)
4255 m_selectedOn->write(writer, u"selectedon"_s);
4257 if (!m_text.isEmpty())
4258 writer.writeCharacters(m_text);
4260 writer.writeEndElement();
4441void DomString::read(QXmlStreamReader &reader)
4443 const QXmlStreamAttributes &attributes = reader.attributes();
4444 for (
const QXmlStreamAttribute &attribute : attributes) {
4445 const auto name = attribute.name();
4446 if (name == u"notr"_s) {
4447 setAttributeNotr(attribute.value().toString());
4450 if (name == u"comment"_s) {
4451 setAttributeComment(attribute.value().toString());
4454 if (name == u"extracomment"_s) {
4455 setAttributeExtraComment(attribute.value().toString());
4458 if (name == u"id"_s) {
4459 setAttributeId(attribute.value().toString());
4462 reader.raiseError(
"Unexpected attribute "_L1 + name);
4465 while (!reader.hasError()) {
4466 switch (reader.readNext()) {
4467 case QXmlStreamReader::StartElement : {
4468 const auto tag = reader.name();
4469 reader.raiseError(
"Unexpected element "_L1 + tag);
4472 case QXmlStreamReader::EndElement :
4474 case QXmlStreamReader::Characters :
4475 if (!reader.isWhitespace())
4476 m_text.append(reader.text().toString());
4484void DomString::write(QXmlStreamWriter &writer,
const QString &tagName)
const
4486 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral(
"string") : tagName.toLower());
4488 if (hasAttributeNotr())
4489 writer.writeAttribute(u"notr"_s, attributeNotr());
4491 if (hasAttributeComment())
4492 writer.writeAttribute(u"comment"_s, attributeComment());
4494 if (hasAttributeExtraComment())
4495 writer.writeAttribute(u"extracomment"_s, attributeExtraComment());
4497 if (hasAttributeId())
4498 writer.writeAttribute(u"id"_s, attributeId());
4500 if (!m_text.isEmpty())
4501 writer.writeCharacters(m_text);
4503 writer.writeEndElement();
4570void DomRectF::read(QXmlStreamReader &reader)
4572 while (!reader.hasError()) {
4573 switch (reader.readNext()) {
4574 case QXmlStreamReader::StartElement : {
4575 const auto tag = reader.name();
4576 if (!tag.compare(u"x"_s, Qt::CaseInsensitive)) {
4577 setElementX(reader.readElementText().toDouble());
4580 if (!tag.compare(u"y"_s, Qt::CaseInsensitive)) {
4581 setElementY(reader.readElementText().toDouble());
4584 if (!tag.compare(u"width"_s, Qt::CaseInsensitive)) {
4585 setElementWidth(reader.readElementText().toDouble());
4588 if (!tag.compare(u"height"_s, Qt::CaseInsensitive)) {
4589 setElementHeight(reader.readElementText().toDouble());
4592 reader.raiseError(
"Unexpected element "_L1 + tag);
4595 case QXmlStreamReader::EndElement :
4603void DomRectF::write(QXmlStreamWriter &writer,
const QString &tagName)
const
4605 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral(
"rectf") : tagName.toLower());
4608 writer.writeTextElement(u"x"_s, QString::number(m_x,
'f', 15));
4611 writer.writeTextElement(u"y"_s, QString::number(m_y,
'f', 15));
4613 if (m_children & Width)
4614 writer.writeTextElement(u"width"_s, QString::number(m_width,
'f', 15));
4616 if (m_children & Height)
4617 writer.writeTextElement(u"height"_s, QString::number(m_height,
'f', 15));
4619 writer.writeEndElement();
4913void DomProperty::read(QXmlStreamReader &reader)
4915 const QXmlStreamAttributes &attributes = reader.attributes();
4916 for (
const QXmlStreamAttribute &attribute : attributes) {
4917 const auto name = attribute.name();
4918 if (name == u"name"_s) {
4919 setAttributeName(attribute.value().toString());
4922 if (name == u"stdset"_s) {
4923 setAttributeStdset(attribute.value().toInt());
4926 reader.raiseError(
"Unexpected attribute "_L1 + name);
4929 while (!reader.hasError()) {
4930 switch (reader.readNext()) {
4931 case QXmlStreamReader::StartElement : {
4932 const auto tag = reader.name();
4933 if (!tag.compare(u"bool"_s, Qt::CaseInsensitive)) {
4934 setElementBool(reader.readElementText());
4937 if (!tag.compare(u"color"_s, Qt::CaseInsensitive)) {
4938 auto *v =
new DomColor();
4943 if (!tag.compare(u"cstring"_s, Qt::CaseInsensitive)) {
4944 setElementCstring(reader.readElementText());
4947 if (!tag.compare(u"cursor"_s, Qt::CaseInsensitive)) {
4948 setElementCursor(reader.readElementText().toInt());
4951 if (!tag.compare(u"cursorshape"_s, Qt::CaseInsensitive)) {
4952 setElementCursorShape(reader.readElementText());
4955 if (!tag.compare(u"enum"_s, Qt::CaseInsensitive)) {
4956 setElementEnum(reader.readElementText());
4959 if (!tag.compare(u"font"_s, Qt::CaseInsensitive)) {
4960 auto *v =
new DomFont();
4965 if (!tag.compare(u"iconset"_s, Qt::CaseInsensitive)) {
4966 auto *v =
new DomResourceIcon();
4968 setElementIconSet(v);
4971 if (!tag.compare(u"pixmap"_s, Qt::CaseInsensitive)) {
4972 auto *v =
new DomResourcePixmap();
4974 setElementPixmap(v);
4977 if (!tag.compare(u"palette"_s, Qt::CaseInsensitive)) {
4978 auto *v =
new DomPalette();
4980 setElementPalette(v);
4983 if (!tag.compare(u"point"_s, Qt::CaseInsensitive)) {
4984 auto *v =
new DomPoint();
4989 if (!tag.compare(u"rect"_s, Qt::CaseInsensitive)) {
4990 auto *v =
new DomRect();
4995 if (!tag.compare(u"set"_s, Qt::CaseInsensitive)) {
4996 setElementSet(reader.readElementText());
4999 if (!tag.compare(u"locale"_s, Qt::CaseInsensitive)) {
5000 auto *v =
new DomLocale();
5002 setElementLocale(v);
5005 if (!tag.compare(u"sizepolicy"_s, Qt::CaseInsensitive)) {
5006 auto *v =
new DomSizePolicy();
5008 setElementSizePolicy(v);
5011 if (!tag.compare(u"size"_s, Qt::CaseInsensitive)) {
5012 auto *v =
new DomSize();
5017 if (!tag.compare(u"string"_s, Qt::CaseInsensitive)) {
5018 auto *v =
new DomString();
5020 setElementString(v);
5023 if (!tag.compare(u"stringlist"_s, Qt::CaseInsensitive)) {
5024 auto *v =
new DomStringList();
5026 setElementStringList(v);
5029 if (!tag.compare(u"number"_s, Qt::CaseInsensitive)) {
5030 setElementNumber(reader.readElementText().toInt());
5033 if (!tag.compare(u"float"_s, Qt::CaseInsensitive)) {
5034 setElementFloat(reader.readElementText().toFloat());
5037 if (!tag.compare(u"double"_s, Qt::CaseInsensitive)) {
5038 setElementDouble(reader.readElementText().toDouble());
5041 if (!tag.compare(u"date"_s, Qt::CaseInsensitive)) {
5042 auto *v =
new DomDate();
5047 if (!tag.compare(u"time"_s, Qt::CaseInsensitive)) {
5048 auto *v =
new DomTime();
5053 if (!tag.compare(u"datetime"_s, Qt::CaseInsensitive)) {
5054 auto *v =
new DomDateTime();
5056 setElementDateTime(v);
5059 if (!tag.compare(u"pointf"_s, Qt::CaseInsensitive)) {
5060 auto *v =
new DomPointF();
5062 setElementPointF(v);
5065 if (!tag.compare(u"rectf"_s, Qt::CaseInsensitive)) {
5066 auto *v =
new DomRectF();
5071 if (!tag.compare(u"sizef"_s, Qt::CaseInsensitive)) {
5072 auto *v =
new DomSizeF();
5077 if (!tag.compare(u"longlong"_s, Qt::CaseInsensitive)) {
5078 setElementLongLong(reader.readElementText().toLongLong());
5081 if (!tag.compare(u"char"_s, Qt::CaseInsensitive)) {
5082 auto *v =
new DomChar();
5087 if (!tag.compare(u"url"_s, Qt::CaseInsensitive)) {
5088 auto *v =
new DomUrl();
5093 if (!tag.compare(u"uint"_s, Qt::CaseInsensitive)) {
5094 setElementUInt(reader.readElementText().toUInt());
5097 if (!tag.compare(u"ulonglong"_s, Qt::CaseInsensitive)) {
5098 setElementULongLong(reader.readElementText().toULongLong());
5101 if (!tag.compare(u"brush"_s, Qt::CaseInsensitive)) {
5102 auto *v =
new DomBrush();
5107 reader.raiseError(
"Unexpected element "_L1 + tag);
5110 case QXmlStreamReader::EndElement :
5118void DomProperty::write(QXmlStreamWriter &writer,
const QString &tagName)
const
5120 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral(
"property") : tagName.toLower());
5122 if (hasAttributeName())
5123 writer.writeAttribute(u"name"_s, attributeName());
5125 if (hasAttributeStdset())
5126 writer.writeAttribute(u"stdset"_s, QString::number(attributeStdset()));
5130 writer.writeTextElement(u"bool"_s, elementBool());
5134 if (m_color !=
nullptr)
5135 m_color->write(writer, u"color"_s);
5139 writer.writeTextElement(u"cstring"_s, elementCstring());
5143 writer.writeTextElement(u"cursor"_s, QString::number(elementCursor()));
5147 writer.writeTextElement(u"cursorShape"_s, elementCursorShape());
5151 writer.writeTextElement(u"enum"_s, elementEnum());
5155 if (m_font !=
nullptr)
5156 m_font->write(writer, u"font"_s);
5160 if (m_iconSet !=
nullptr)
5161 m_iconSet->write(writer, u"iconset"_s);
5165 if (m_pixmap !=
nullptr)
5166 m_pixmap->write(writer, u"pixmap"_s);
5170 if (m_palette !=
nullptr)
5171 m_palette->write(writer, u"palette"_s);
5175 if (m_point !=
nullptr)
5176 m_point->write(writer, u"point"_s);
5180 if (m_rect !=
nullptr)
5181 m_rect->write(writer, u"rect"_s);
5185 writer.writeTextElement(u"set"_s, elementSet());
5189 if (m_locale !=
nullptr)
5190 m_locale->write(writer, u"locale"_s);
5194 if (m_sizePolicy !=
nullptr)
5195 m_sizePolicy->write(writer, u"sizepolicy"_s);
5199 if (m_size !=
nullptr)
5200 m_size->write(writer, u"size"_s);
5204 if (m_string !=
nullptr)
5205 m_string->write(writer, u"string"_s);
5209 if (m_stringList !=
nullptr)
5210 m_stringList->write(writer, u"stringlist"_s);
5214 writer.writeTextElement(u"number"_s, QString::number(elementNumber()));
5218 writer.writeTextElement(u"float"_s, QString::number(elementFloat(),
'f', 8));
5222 writer.writeTextElement(u"double"_s, QString::number(elementDouble(),
'f', 15));
5226 if (m_date !=
nullptr)
5227 m_date->write(writer, u"date"_s);
5231 if (m_time !=
nullptr)
5232 m_time->write(writer, u"time"_s);
5236 if (m_dateTime !=
nullptr)
5237 m_dateTime->write(writer, u"datetime"_s);
5241 if (m_pointF !=
nullptr)
5242 m_pointF->write(writer, u"pointf"_s);
5246 if (m_rectF !=
nullptr)
5247 m_rectF->write(writer, u"rectf"_s);
5251 if (m_sizeF !=
nullptr)
5252 m_sizeF->write(writer, u"sizef"_s);
5256 writer.writeTextElement(u"longLong"_s, QString::number(elementLongLong()));
5260 if (m_char !=
nullptr)
5261 m_char->write(writer, u"char"_s);
5265 if (m_url !=
nullptr)
5266 m_url->write(writer, u"url"_s);
5270 writer.writeTextElement(u"UInt"_s, QString::number(elementUInt()));
5274 writer.writeTextElement(u"uLongLong"_s, QString::number(elementULongLong()));
5278 if (m_brush !=
nullptr)
5279 m_brush->write(writer, u"brush"_s);
5285 writer.writeEndElement();
5716void DomConnection::read(QXmlStreamReader &reader)
5718 while (!reader.hasError()) {
5719 switch (reader.readNext()) {
5720 case QXmlStreamReader::StartElement : {
5721 const auto tag = reader.name();
5722 if (!tag.compare(u"sender"_s, Qt::CaseInsensitive)) {
5723 setElementSender(reader.readElementText());
5726 if (!tag.compare(u"signal"_s, Qt::CaseInsensitive)) {
5727 setElementSignal(reader.readElementText());
5730 if (!tag.compare(u"receiver"_s, Qt::CaseInsensitive)) {
5731 setElementReceiver(reader.readElementText());
5734 if (!tag.compare(u"slot"_s, Qt::CaseInsensitive)) {
5735 setElementSlot(reader.readElementText());
5738 if (!tag.compare(u"hints"_s, Qt::CaseInsensitive)) {
5739 auto *v =
new DomConnectionHints();
5744 reader.raiseError(
"Unexpected element "_L1 + tag);
5747 case QXmlStreamReader::EndElement :
5755void DomConnection::write(QXmlStreamWriter &writer,
const QString &tagName)
const
5757 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral(
"connection") : tagName.toLower());
5759 if (m_children & Sender)
5760 writer.writeTextElement(u"sender"_s, m_sender);
5762 if (m_children & Signal)
5763 writer.writeTextElement(u"signal"_s, m_signal);
5765 if (m_children & Receiver)
5766 writer.writeTextElement(u"receiver"_s, m_receiver);
5768 if (m_children & Slot)
5769 writer.writeTextElement(u"slot"_s, m_slot);
5771 if (m_children & Hints)
5772 m_hints->write(writer, u"hints"_s);
5774 writer.writeEndElement();
5890void DomConnectionHint::read(QXmlStreamReader &reader)
5892 const QXmlStreamAttributes &attributes = reader.attributes();
5893 for (
const QXmlStreamAttribute &attribute : attributes) {
5894 const auto name = attribute.name();
5895 if (name == u"type"_s) {
5896 setAttributeType(attribute.value().toString());
5899 reader.raiseError(
"Unexpected attribute "_L1 + name);
5902 while (!reader.hasError()) {
5903 switch (reader.readNext()) {
5904 case QXmlStreamReader::StartElement : {
5905 const auto tag = reader.name();
5906 if (!tag.compare(u"x"_s, Qt::CaseInsensitive)) {
5907 setElementX(reader.readElementText().toInt());
5910 if (!tag.compare(u"y"_s, Qt::CaseInsensitive)) {
5911 setElementY(reader.readElementText().toInt());
5914 reader.raiseError(
"Unexpected element "_L1 + tag);
5917 case QXmlStreamReader::EndElement :