/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the tools applications of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:GPL-EXCEPT$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms ** and conditions see https://www.qt.io/terms-conditions. For further ** information use the contact form at https://www.qt.io/contact-us. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3 as published by the Free Software ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT ** included in the packaging of this file. Please review the following ** information to ensure the GNU General Public License requirements will ** be met: https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** ****************************************************************************/ // THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT! #include "ui4.h" QT_BEGIN_NAMESPACE #ifdef QFORMINTERNAL_NAMESPACE using namespace QFormInternal; #endif /******************************************************************************* ** Implementations */ DomUI::~DomUI() { delete m_widget; delete m_layoutDefault; delete m_layoutFunction; delete m_customWidgets; delete m_tabStops; delete m_includes; delete m_resources; delete m_connections; delete m_designerdata; delete m_slots; delete m_buttonGroups; } void DomUI::read(QXmlStreamReader &reader) { const QXmlStreamAttributes &attributes = reader.attributes(); for (const QXmlStreamAttribute &attribute : attributes) { const auto name = attribute.name(); if (name == QLatin1String("version")) { setAttributeVersion(attribute.value().toString()); continue; } if (name == QLatin1String("language")) { setAttributeLanguage(attribute.value().toString()); continue; } if (name == QLatin1String("displayname")) { setAttributeDisplayname(attribute.value().toString()); continue; } if (name == QLatin1String("idbasedtr")) { setAttributeIdbasedtr(attribute.value() == QLatin1String("true")); continue; } if (name == QLatin1String("connectslotsbyname")) { setAttributeConnectslotsbyname(attribute.value() == QLatin1String("true")); continue; } if (name == QLatin1String("stdsetdef")) { setAttributeStdsetdef(attribute.value().toInt()); continue; } if (name == QLatin1String("stdSetDef")) { setAttributeStdSetDef(attribute.value().toInt()); continue; } reader.raiseError(QLatin1String("Unexpected attribute ") + name); } while (!reader.hasError()) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const auto tag = reader.name(); if (!tag.compare(QLatin1String("author"), Qt::CaseInsensitive)) { setElementAuthor(reader.readElementText()); continue; } if (!tag.compare(QLatin1String("comment"), Qt::CaseInsensitive)) { setElementComment(reader.readElementText()); continue; } if (!tag.compare(QLatin1String("exportmacro"), Qt::CaseInsensitive)) { setElementExportMacro(reader.readElementText()); continue; } if (!tag.compare(QLatin1String("class"), Qt::CaseInsensitive)) { setElementClass(reader.readElementText()); continue; } if (!tag.compare(QLatin1String("widget"), Qt::CaseInsensitive)) { auto *v = new DomWidget(); v->read(reader); setElementWidget(v); continue; } if (!tag.compare(QLatin1String("layoutdefault"), Qt::CaseInsensitive)) { auto *v = new DomLayoutDefault(); v->read(reader); setElementLayoutDefault(v); continue; } if (!tag.compare(QLatin1String("layoutfunction"), Qt::CaseInsensitive)) { auto *v = new DomLayoutFunction(); v->read(reader); setElementLayoutFunction(v); continue; } if (!tag.compare(QLatin1String("pixmapfunction"), Qt::CaseInsensitive)) { setElementPixmapFunction(reader.readElementText()); continue; } if (!tag.compare(QLatin1String("customwidgets"), Qt::CaseInsensitive)) { auto *v = new DomCustomWidgets(); v->read(reader); setElementCustomWidgets(v); continue; } if (!tag.compare(QLatin1String("tabstops"), Qt::CaseInsensitive)) { auto *v = new DomTabStops(); v->read(reader); setElementTabStops(v); continue; } if (!tag.compare(QLatin1String("images"), Qt::CaseInsensitive)) { qWarning("Omitting deprecated element ."); reader.skipCurrentElement(); continue; } if (!tag.compare(QLatin1String("includes"), Qt::CaseInsensitive)) { auto *v = new DomIncludes(); v->read(reader); setElementIncludes(v); continue; } if (!tag.compare(QLatin1String("resources"), Qt::CaseInsensitive)) { auto *v = new DomResources(); v->read(reader); setElementResources(v); continue; } if (!tag.compare(QLatin1String("connections"), Qt::CaseInsensitive)) { auto *v = new DomConnections(); v->read(reader); setElementConnections(v); continue; } if (!tag.compare(QLatin1String("designerdata"), Qt::CaseInsensitive)) { auto *v = new DomDesignerData(); v->read(reader); setElementDesignerdata(v); continue; } if (!tag.compare(QLatin1String("slots"), Qt::CaseInsensitive)) { auto *v = new DomSlots(); v->read(reader); setElementSlots(v); continue; } if (!tag.compare(QLatin1String("buttongroups"), Qt::CaseInsensitive)) { auto *v = new DomButtonGroups(); v->read(reader); setElementButtonGroups(v); continue; } reader.raiseError(QLatin1String("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : return; default : break; } } } void DomUI::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("ui") : tagName.toLower()); if (hasAttributeVersion()) writer.writeAttribute(QStringLiteral("version"), attributeVersion()); if (hasAttributeLanguage()) writer.writeAttribute(QStringLiteral("language"), attributeLanguage()); if (hasAttributeDisplayname()) writer.writeAttribute(QStringLiteral("displayname"), attributeDisplayname()); if (hasAttributeIdbasedtr()) writer.writeAttribute(QStringLiteral("idbasedtr"), (attributeIdbasedtr() ? QLatin1String("true") : QLatin1String("false"))); if (hasAttributeConnectslotsbyname()) writer.writeAttribute(QStringLiteral("connectslotsbyname"), (attributeConnectslotsbyname() ? QLatin1String("true") : QLatin1String("false"))); if (hasAttributeStdsetdef()) writer.writeAttribute(QStringLiteral("stdsetdef"), QString::number(attributeStdsetdef())); if (hasAttributeStdSetDef()) writer.writeAttribute(QStringLiteral("stdsetdef"), QString::number(attributeStdSetDef())); if (m_children & Author) writer.writeTextElement(QStringLiteral("author"), m_author); if (m_children & Comment) writer.writeTextElement(QStringLiteral("comment"), m_comment); if (m_children & ExportMacro) writer.writeTextElement(QStringLiteral("exportmacro"), m_exportMacro); if (m_children & Class) writer.writeTextElement(QStringLiteral("class"), m_class); if (m_children & Widget) m_widget->write(writer, QStringLiteral("widget")); if (m_children & LayoutDefault) m_layoutDefault->write(writer, QStringLiteral("layoutdefault")); if (m_children & LayoutFunction) m_layoutFunction->write(writer, QStringLiteral("layoutfunction")); if (m_children & PixmapFunction) writer.writeTextElement(QStringLiteral("pixmapfunction"), m_pixmapFunction); if (m_children & CustomWidgets) m_customWidgets->write(writer, QStringLiteral("customwidgets")); if (m_children & TabStops) m_tabStops->write(writer, QStringLiteral("tabstops")); if (m_children & Includes) m_includes->write(writer, QStringLiteral("includes")); if (m_children & Resources) m_resources->write(writer, QStringLiteral("resources")); if (m_children & Connections) m_connections->write(writer, QStringLiteral("connections")); if (m_children & Designerdata) m_designerdata->write(writer, QStringLiteral("designerdata")); if (m_children & Slots) m_slots->write(writer, QStringLiteral("slots")); if (m_children & ButtonGroups) m_buttonGroups->write(writer, QStringLiteral("buttongroups")); writer.writeEndElement(); } void DomUI::setElementAuthor(const QString &a) { m_children |= Author; m_author = a; } void DomUI::setElementComment(const QString &a) { m_children |= Comment; m_comment = a; } void DomUI::setElementExportMacro(const QString &a) { m_children |= ExportMacro; m_exportMacro = a; } void DomUI::setElementClass(const QString &a) { m_children |= Class; m_class = a; } DomWidget *DomUI::takeElementWidget() { DomWidget *a = m_widget; m_widget = nullptr; m_children ^= Widget; return a; } void DomUI::setElementWidget(DomWidget *a) { delete m_widget; m_children |= Widget; m_widget = a; } DomLayoutDefault *DomUI::takeElementLayoutDefault() { DomLayoutDefault *a = m_layoutDefault; m_layoutDefault = nullptr; m_children ^= LayoutDefault; return a; } void DomUI::setElementLayoutDefault(DomLayoutDefault *a) { delete m_layoutDefault; m_children |= LayoutDefault; m_layoutDefault = a; } DomLayoutFunction *DomUI::takeElementLayoutFunction() { DomLayoutFunction *a = m_layoutFunction; m_layoutFunction = nullptr; m_children ^= LayoutFunction; return a; } void DomUI::setElementLayoutFunction(DomLayoutFunction *a) { delete m_layoutFunction; m_children |= LayoutFunction; m_layoutFunction = a; } void DomUI::setElementPixmapFunction(const QString &a) { m_children |= PixmapFunction; m_pixmapFunction = a; } DomCustomWidgets *DomUI::takeElementCustomWidgets() { DomCustomWidgets *a = m_customWidgets; m_customWidgets = nullptr; m_children ^= CustomWidgets; return a; } void DomUI::setElementCustomWidgets(DomCustomWidgets *a) { delete m_customWidgets; m_children |= CustomWidgets; m_customWidgets = a; } DomTabStops *DomUI::takeElementTabStops() { DomTabStops *a = m_tabStops; m_tabStops = nullptr; m_children ^= TabStops; return a; } void DomUI::setElementTabStops(DomTabStops *a) { delete m_tabStops; m_children |= TabStops; m_tabStops = a; } DomIncludes *DomUI::takeElementIncludes() { DomIncludes *a = m_includes; m_includes = nullptr; m_children ^= Includes; return a; } void DomUI::setElementIncludes(DomIncludes *a) { delete m_includes; m_children |= Includes; m_includes = a; } DomResources *DomUI::takeElementResources() { DomResources *a = m_resources; m_resources = nullptr; m_children ^= Resources; return a; } void DomUI::setElementResources(DomResources *a) { delete m_resources; m_children |= Resources; m_resources = a; } DomConnections *DomUI::takeElementConnections() { DomConnections *a = m_connections; m_connections = nullptr; m_children ^= Connections; return a; } void DomUI::setElementConnections(DomConnections *a) { delete m_connections; m_children |= Connections; m_connections = a; } DomDesignerData *DomUI::takeElementDesignerdata() { DomDesignerData *a = m_designerdata; m_designerdata = nullptr; m_children ^= Designerdata; return a; } void DomUI::setElementDesignerdata(DomDesignerData *a) { delete m_designerdata; m_children |= Designerdata; m_designerdata = a; } DomSlots *DomUI::takeElementSlots() { DomSlots *a = m_slots; m_slots = nullptr; m_children ^= Slots; return a; } void DomUI::setElementSlots(DomSlots *a) { delete m_slots; m_children |= Slots; m_slots = a; } DomButtonGroups *DomUI::takeElementButtonGroups() { DomButtonGroups *a = m_buttonGroups; m_buttonGroups = nullptr; m_children ^= ButtonGroups; return a; } void DomUI::setElementButtonGroups(DomButtonGroups *a) { delete m_buttonGroups; m_children |= ButtonGroups; m_buttonGroups = a; } void DomUI::clearElementAuthor() { m_children &= ~Author; } void DomUI::clearElementComment() { m_children &= ~Comment; } void DomUI::clearElementExportMacro() { m_children &= ~ExportMacro; } void DomUI::clearElementClass() { m_children &= ~Class; } void DomUI::clearElementWidget() { delete m_widget; m_widget = nullptr; m_children &= ~Widget; } void DomUI::clearElementLayoutDefault() { delete m_layoutDefault; m_layoutDefault = nullptr; m_children &= ~LayoutDefault; } void DomUI::clearElementLayoutFunction() { delete m_layoutFunction; m_layoutFunction = nullptr; m_children &= ~LayoutFunction; } void DomUI::clearElementPixmapFunction() { m_children &= ~PixmapFunction; } void DomUI::clearElementCustomWidgets() { delete m_customWidgets; m_customWidgets = nullptr; m_children &= ~CustomWidgets; } void DomUI::clearElementTabStops() { delete m_tabStops; m_tabStops = nullptr; m_children &= ~TabStops; } void DomUI::clearElementIncludes() { delete m_includes; m_includes = nullptr; m_children &= ~Includes; } void DomUI::clearElementResources() { delete m_resources; m_resources = nullptr; m_children &= ~Resources; } void DomUI::clearElementConnections() { delete m_connections; m_connections = nullptr; m_children &= ~Connections; } void DomUI::clearElementDesignerdata() { delete m_designerdata; m_designerdata = nullptr; m_children &= ~Designerdata; } void DomUI::clearElementSlots() { delete m_slots; m_slots = nullptr; m_children &= ~Slots; } void DomUI::clearElementButtonGroups() { delete m_buttonGroups; m_buttonGroups = nullptr; m_children &= ~ButtonGroups; } DomIncludes::~DomIncludes() { qDeleteAll(m_include); m_include.clear(); } void DomIncludes::read(QXmlStreamReader &reader) { while (!reader.hasError()) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const auto tag = reader.name(); if (!tag.compare(QLatin1String("include"), Qt::CaseInsensitive)) { auto *v = new DomInclude(); v->read(reader); m_include.append(v); continue; } reader.raiseError(QLatin1String("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : return; default : break; } } } void DomIncludes::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("includes") : tagName.toLower()); for (DomInclude *v : m_include) v->write(writer, QStringLiteral("include")); writer.writeEndElement(); } void DomIncludes::setElementInclude(const QVector &a) { m_children |= Include; m_include = a; } DomInclude::~DomInclude() = default; void DomInclude::read(QXmlStreamReader &reader) { const QXmlStreamAttributes &attributes = reader.attributes(); for (const QXmlStreamAttribute &attribute : attributes) { const auto name = attribute.name(); if (name == QLatin1String("location")) { setAttributeLocation(attribute.value().toString()); continue; } if (name == QLatin1String("impldecl")) { setAttributeImpldecl(attribute.value().toString()); continue; } reader.raiseError(QLatin1String("Unexpected attribute ") + name); } while (!reader.hasError()) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const auto tag = reader.name(); reader.raiseError(QLatin1String("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : return; case QXmlStreamReader::Characters : if (!reader.isWhitespace()) m_text.append(reader.text().toString()); break; default : break; } } } void DomInclude::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("include") : tagName.toLower()); if (hasAttributeLocation()) writer.writeAttribute(QStringLiteral("location"), attributeLocation()); if (hasAttributeImpldecl()) writer.writeAttribute(QStringLiteral("impldecl"), attributeImpldecl()); if (!m_text.isEmpty()) writer.writeCharacters(m_text); writer.writeEndElement(); } DomResources::~DomResources() { qDeleteAll(m_include); m_include.clear(); } void DomResources::read(QXmlStreamReader &reader) { const QXmlStreamAttributes &attributes = reader.attributes(); for (const QXmlStreamAttribute &attribute : attributes) { const auto name = attribute.name(); if (name == QLatin1String("name")) { setAttributeName(attribute.value().toString()); continue; } reader.raiseError(QLatin1String("Unexpected attribute ") + name); } while (!reader.hasError()) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const auto tag = reader.name(); if (!tag.compare(QLatin1String("include"), Qt::CaseInsensitive)) { auto *v = new DomResource(); v->read(reader); m_include.append(v); continue; } reader.raiseError(QLatin1String("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : return; default : break; } } } void DomResources::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("resources") : tagName.toLower()); if (hasAttributeName()) writer.writeAttribute(QStringLiteral("name"), attributeName()); for (DomResource *v : m_include) v->write(writer, QStringLiteral("include")); writer.writeEndElement(); } void DomResources::setElementInclude(const QVector &a) { m_children |= Include; m_include = a; } DomResource::~DomResource() = default; void DomResource::read(QXmlStreamReader &reader) { const QXmlStreamAttributes &attributes = reader.attributes(); for (const QXmlStreamAttribute &attribute : attributes) { const auto name = attribute.name(); if (name == QLatin1String("location")) { setAttributeLocation(attribute.value().toString()); continue; } reader.raiseError(QLatin1String("Unexpected attribute ") + name); } while (!reader.hasError()) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const auto tag = reader.name(); reader.raiseError(QLatin1String("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : return; default : break; } } } void DomResource::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("resource") : tagName.toLower()); if (hasAttributeLocation()) writer.writeAttribute(QStringLiteral("location"), attributeLocation()); writer.writeEndElement(); } DomActionGroup::~DomActionGroup() { qDeleteAll(m_action); m_action.clear(); qDeleteAll(m_actionGroup); m_actionGroup.clear(); qDeleteAll(m_property); m_property.clear(); qDeleteAll(m_attribute); m_attribute.clear(); } void DomActionGroup::read(QXmlStreamReader &reader) { const QXmlStreamAttributes &attributes = reader.attributes(); for (const QXmlStreamAttribute &attribute : attributes) { const auto name = attribute.name(); if (name == QLatin1String("name")) { setAttributeName(attribute.value().toString()); continue; } reader.raiseError(QLatin1String("Unexpected attribute ") + name); } while (!reader.hasError()) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const auto tag = reader.name(); if (!tag.compare(QLatin1String("action"), Qt::CaseInsensitive)) { auto *v = new DomAction(); v->read(reader); m_action.append(v); continue; } if (!tag.compare(QLatin1String("actiongroup"), Qt::CaseInsensitive)) { auto *v = new DomActionGroup(); v->read(reader); m_actionGroup.append(v); continue; } if (!tag.compare(QLatin1String("property"), Qt::CaseInsensitive)) { auto *v = new DomProperty(); v->read(reader); m_property.append(v); continue; } if (!tag.compare(QLatin1String("attribute"), Qt::CaseInsensitive)) { auto *v = new DomProperty(); v->read(reader); m_attribute.append(v); continue; } reader.raiseError(QLatin1String("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : return; default : break; } } } void DomActionGroup::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("actiongroup") : tagName.toLower()); if (hasAttributeName()) writer.writeAttribute(QStringLiteral("name"), attributeName()); for (DomAction *v : m_action) v->write(writer, QStringLiteral("action")); for (DomActionGroup *v : m_actionGroup) v->write(writer, QStringLiteral("actiongroup")); for (DomProperty *v : m_property) v->write(writer, QStringLiteral("property")); for (DomProperty *v : m_attribute) v->write(writer, QStringLiteral("attribute")); writer.writeEndElement(); } void DomActionGroup::setElementAction(const QVector &a) { m_children |= Action; m_action = a; } void DomActionGroup::setElementActionGroup(const QVector &a) { m_children |= ActionGroup; m_actionGroup = a; } void DomActionGroup::setElementProperty(const QVector &a) { m_children |= Property; m_property = a; } void DomActionGroup::setElementAttribute(const QVector &a) { m_children |= Attribute; m_attribute = a; } DomAction::~DomAction() { qDeleteAll(m_property); m_property.clear(); qDeleteAll(m_attribute); m_attribute.clear(); } void DomAction::read(QXmlStreamReader &reader) { const QXmlStreamAttributes &attributes = reader.attributes(); for (const QXmlStreamAttribute &attribute : attributes) { const auto name = attribute.name(); if (name == QLatin1String("name")) { setAttributeName(attribute.value().toString()); continue; } if (name == QLatin1String("menu")) { setAttributeMenu(attribute.value().toString()); continue; } reader.raiseError(QLatin1String("Unexpected attribute ") + name); } while (!reader.hasError()) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const auto tag = reader.name(); if (!tag.compare(QLatin1String("property"), Qt::CaseInsensitive)) { auto *v = new DomProperty(); v->read(reader); m_property.append(v); continue; } if (!tag.compare(QLatin1String("attribute"), Qt::CaseInsensitive)) { auto *v = new DomProperty(); v->read(reader); m_attribute.append(v); continue; } reader.raiseError(QLatin1String("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : return; default : break; } } } void DomAction::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("action") : tagName.toLower()); if (hasAttributeName()) writer.writeAttribute(QStringLiteral("name"), attributeName()); if (hasAttributeMenu()) writer.writeAttribute(QStringLiteral("menu"), attributeMenu()); for (DomProperty *v : m_property) v->write(writer, QStringLiteral("property")); for (DomProperty *v : m_attribute) v->write(writer, QStringLiteral("attribute")); writer.writeEndElement(); } void DomAction::setElementProperty(const QVector &a) { m_children |= Property; m_property = a; } void DomAction::setElementAttribute(const QVector &a) { m_children |= Attribute; m_attribute = a; } DomActionRef::~DomActionRef() = default; void DomActionRef::read(QXmlStreamReader &reader) { const QXmlStreamAttributes &attributes = reader.attributes(); for (const QXmlStreamAttribute &attribute : attributes) { const auto name = attribute.name(); if (name == QLatin1String("name")) { setAttributeName(attribute.value().toString()); continue; } reader.raiseError(QLatin1String("Unexpected attribute ") + name); } while (!reader.hasError()) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const auto tag = reader.name(); reader.raiseError(QLatin1String("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : return; default : break; } } } void DomActionRef::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("actionref") : tagName.toLower()); if (hasAttributeName()) writer.writeAttribute(QStringLiteral("name"), attributeName()); writer.writeEndElement(); } DomButtonGroup::~DomButtonGroup() { qDeleteAll(m_property); m_property.clear(); qDeleteAll(m_attribute); m_attribute.clear(); } void DomButtonGroup::read(QXmlStreamReader &reader) { const QXmlStreamAttributes &attributes = reader.attributes(); for (const QXmlStreamAttribute &attribute : attributes) { const auto name = attribute.name(); if (name == QLatin1String("name")) { setAttributeName(attribute.value().toString()); continue; } reader.raiseError(QLatin1String("Unexpected attribute ") + name); } while (!reader.hasError()) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const auto tag = reader.name(); if (!tag.compare(QLatin1String("property"), Qt::CaseInsensitive)) { auto *v = new DomProperty(); v->read(reader); m_property.append(v); continue; } if (!tag.compare(QLatin1String("attribute"), Qt::CaseInsensitive)) { auto *v = new DomProperty(); v->read(reader); m_attribute.append(v); continue; } reader.raiseError(QLatin1String("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : return; default : break; } } } void DomButtonGroup::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("buttongroup") : tagName.toLower()); if (hasAttributeName()) writer.writeAttribute(QStringLiteral("name"), attributeName()); for (DomProperty *v : m_property) v->write(writer, QStringLiteral("property")); for (DomProperty *v : m_attribute) v->write(writer, QStringLiteral("attribute")); writer.writeEndElement(); } void DomButtonGroup::setElementProperty(const QVector &a) { m_children |= Property; m_property = a; } void DomButtonGroup::setElementAttribute(const QVector &a) { m_children |= Attribute; m_attribute = a; } DomButtonGroups::~DomButtonGroups() { qDeleteAll(m_buttonGroup); m_buttonGroup.clear(); } void DomButtonGroups::read(QXmlStreamReader &reader) { while (!reader.hasError()) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const auto tag = reader.name(); if (!tag.compare(QLatin1String("buttongroup"), Qt::CaseInsensitive)) { auto *v = new DomButtonGroup(); v->read(reader); m_buttonGroup.append(v); continue; } reader.raiseError(QLatin1String("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : return; default : break; } } } void DomButtonGroups::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("buttongroups") : tagName.toLower()); for (DomButtonGroup *v : m_buttonGroup) v->write(writer, QStringLiteral("buttongroup")); writer.writeEndElement(); } void DomButtonGroups::setElementButtonGroup(const QVector &a) { m_children |= ButtonGroup; m_buttonGroup = a; } DomCustomWidgets::~DomCustomWidgets() { qDeleteAll(m_customWidget); m_customWidget.clear(); } void DomCustomWidgets::read(QXmlStreamReader &reader) { while (!reader.hasError()) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const auto tag = reader.name(); if (!tag.compare(QLatin1String("customwidget"), Qt::CaseInsensitive)) { auto *v = new DomCustomWidget(); v->read(reader); m_customWidget.append(v); continue; } reader.raiseError(QLatin1String("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : return; default : break; } } } void DomCustomWidgets::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("customwidgets") : tagName.toLower()); for (DomCustomWidget *v : m_customWidget) v->write(writer, QStringLiteral("customwidget")); writer.writeEndElement(); } void DomCustomWidgets::setElementCustomWidget(const QVector &a) { m_children |= CustomWidget; m_customWidget = a; } DomHeader::~DomHeader() = default; void DomHeader::read(QXmlStreamReader &reader) { const QXmlStreamAttributes &attributes = reader.attributes(); for (const QXmlStreamAttribute &attribute : attributes) { const auto name = attribute.name(); if (name == QLatin1String("location")) { setAttributeLocation(attribute.value().toString()); continue; } reader.raiseError(QLatin1String("Unexpected attribute ") + name); } while (!reader.hasError()) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const auto tag = reader.name(); reader.raiseError(QLatin1String("Unexpected element ") + tag); } break; case QXmlStreamReader::EndElement : return; case QXmlStreamReader::Characters : if (!reader.isWhitespace()) m_text.append(reader.text().toString()); break; default : break; } } } void DomHeader::write(QXmlStreamWriter &writer, const QString &tagName) const { writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("header") : tagName.toLower()); if (hasAttributeLocation()) writer.writeAttribute(QStringLiteral("location"), attributeLocation()); if (!m_text.isEmpty()) writer.writeCharacters(m_text); writer.writeEndElement(); } DomCustomWidget::~DomCustomWidget() { delete m_header; delete m_sizeHint; delete m_slots; delete m_propertyspecifications; } void DomCustomWidget::read(QXmlStreamReader &reader) { while (!reader.hasError()) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const auto tag = reader.name(); if (!tag.compare(QLatin1String("class"), Qt::CaseInsensitive)) { setElementClass(reader.readElementText()); continue; } if (!tag.compare(QLatin1String("extends"), Qt::CaseInsensitive)) { setElementExtends(reader.readElementText()); continue; } if (!tag.compare(QLatin1String("header"), Qt::CaseInsensitive)) { auto *v = new DomHeader(); v->read(reader); setElementHeader(v); continue; } if (!tag.compare(QLatin1String("sizehint"), Qt::CaseInsensitive)) { auto *v = new DomSize(); v->read(reader); setElementSizeHint(v); continue; } if (!tag.compare(QLatin1String("addpagemethod"), Qt::CaseInsensitive)) { setElementAddPageMethod(reader.readElementText()); continue; } if (!tag.compare(QLatin1String("container"), Qt::CaseInsensitive)) { setElementContainer(reader.readElementText().toInt()); continue; } if (!tag.compare(QLatin1String("sizepolicy"), Qt::CaseInsensitive)) { qWarning("Omitting deprecated element ."); reader.skipCurrentElement(); continue; } if (!tag.compare(QLatin1String("pixmap"), Qt::CaseInsensitive)) { setElementPixmap(reader.readElementText()); continue; } if (!tag.compare(QLatin1String("script"), Qt::CaseInsensitive)) { qWarning("Omitting deprecated element