From d6d76df9e0ed0e9e6c761a1d3c2581ec317d3ebb Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Wed, 31 May 2017 11:44:02 +0200 Subject: [PATCH] Remove ancient embedded pixmaps and scripts from uic Change-Id: Iec06e1af91a6d61226ae484325b1ec82810d634d Reviewed-by: Friedemann Kleint --- src/tools/uic/cpp/cpp.pri | 12 +- src/tools/uic/cpp/cppextractimages.cpp | 140 -- src/tools/uic/cpp/cppextractimages.h | 64 - src/tools/uic/cpp/cppwritedeclaration.cpp | 63 +- src/tools/uic/cpp/cppwritedeclaration.h | 3 +- src/tools/uic/cpp/cppwriteicondata.cpp | 172 -- src/tools/uic/cpp/cppwriteicondata.h | 68 - src/tools/uic/cpp/cppwriteicondeclaration.cpp | 67 - src/tools/uic/cpp/cppwriteicondeclaration.h | 63 - .../uic/cpp/cppwriteiconinitialization.cpp | 102 - .../uic/cpp/cppwriteiconinitialization.h | 68 - src/tools/uic/cpp/cppwriteincludes.cpp | 22 +- src/tools/uic/cpp/cppwriteincludes.h | 5 - src/tools/uic/cpp/cppwriteinitialization.cpp | 82 +- src/tools/uic/cpp/cppwriteinitialization.h | 11 +- src/tools/uic/customwidgetsinfo.cpp | 12 - src/tools/uic/customwidgetsinfo.h | 2 - src/tools/uic/option.h | 2 - src/tools/uic/treewalker.cpp | 20 - src/tools/uic/treewalker.h | 3 - src/tools/uic/ui4.cpp | 1682 +---------------- src/tools/uic/ui4.h | 1209 ++++-------- src/tools/uic/uic.cpp | 7 +- src/tools/uic/uic.h | 7 - 24 files changed, 462 insertions(+), 3424 deletions(-) delete mode 100644 src/tools/uic/cpp/cppextractimages.cpp delete mode 100644 src/tools/uic/cpp/cppextractimages.h delete mode 100644 src/tools/uic/cpp/cppwriteicondata.cpp delete mode 100644 src/tools/uic/cpp/cppwriteicondata.h delete mode 100644 src/tools/uic/cpp/cppwriteicondeclaration.cpp delete mode 100644 src/tools/uic/cpp/cppwriteicondeclaration.h delete mode 100644 src/tools/uic/cpp/cppwriteiconinitialization.cpp delete mode 100644 src/tools/uic/cpp/cppwriteiconinitialization.h diff --git a/src/tools/uic/cpp/cpp.pri b/src/tools/uic/cpp/cpp.pri index 49c71a6dfa..a6b6188117 100644 --- a/src/tools/uic/cpp/cpp.pri +++ b/src/tools/uic/cpp/cpp.pri @@ -3,18 +3,10 @@ INCLUDEPATH += $$PWD $$QT_BUILD_TREE/src/tools/uic DEFINES += QT_UIC_CPP_GENERATOR # Input -HEADERS += $$PWD/cppextractimages.h \ - $$PWD/cppwritedeclaration.h \ - $$PWD/cppwriteicondata.h \ - $$PWD/cppwriteicondeclaration.h \ - $$PWD/cppwriteiconinitialization.h \ +HEADERS += $$PWD/cppwritedeclaration.h \ $$PWD/cppwriteincludes.h \ $$PWD/cppwriteinitialization.h -SOURCES += $$PWD/cppextractimages.cpp \ - $$PWD/cppwritedeclaration.cpp \ - $$PWD/cppwriteicondata.cpp \ - $$PWD/cppwriteicondeclaration.cpp \ - $$PWD/cppwriteiconinitialization.cpp \ +SOURCES += $$PWD/cppwritedeclaration.cpp \ $$PWD/cppwriteincludes.cpp \ $$PWD/cppwriteinitialization.cpp diff --git a/src/tools/uic/cpp/cppextractimages.cpp b/src/tools/uic/cpp/cppextractimages.cpp deleted file mode 100644 index 4d06d08dae..0000000000 --- a/src/tools/uic/cpp/cppextractimages.cpp +++ /dev/null @@ -1,140 +0,0 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ - -#include "cppextractimages.h" -#include "cppwriteicondata.h" -#include "driver.h" -#include "ui4.h" -#include "utils.h" -#include "uic.h" - -#include -#include -#include -#include -#include - -QT_BEGIN_NAMESPACE - -namespace CPP { - -ExtractImages::ExtractImages(const Option &opt) - : m_output(0), m_option(opt) -{ -} - -void ExtractImages::acceptUI(DomUI *node) -{ - if (!m_option.extractImages) - return; - - if (node->elementImages() == 0) - return; - - QString className = node->elementClass() + m_option.postfix; - - QFile f; - if (m_option.qrcOutputFile.size()) { - f.setFileName(m_option.qrcOutputFile); - if (!f.open(QIODevice::WriteOnly | QFile::Text)) { - fprintf(stderr, "%s: Error: Could not create resource file\n", qPrintable(m_option.messagePrefix())); - return; - } - - QFileInfo fi(m_option.qrcOutputFile); - QDir dir = fi.absoluteDir(); - if (!dir.exists(QLatin1String("images")) && !dir.mkdir(QLatin1String("images"))) { - fprintf(stderr, "%s: Error: Could not create image dir\n", qPrintable(m_option.messagePrefix())); - return; - } - dir.cd(QLatin1String("images")); - m_imagesDir = dir; - - m_output = new QTextStream(&f); -#ifndef QT_NO_TEXTCODEC - m_output->setCodec(QTextCodec::codecForName("UTF-8")); -#endif - - QTextStream &out = *m_output; - - out << "\n"; - out << " \n"; - TreeWalker::acceptUI(node); - out << " \n"; - out << "\n"; - - f.close(); - delete m_output; - m_output = 0; - } -} - -void ExtractImages::acceptImages(DomImages *images) -{ - TreeWalker::acceptImages(images); -} - -void ExtractImages::acceptImage(DomImage *image) -{ - QString format = image->elementData()->attributeFormat(); - QString extension = format.left(format.indexOf(QLatin1Char('.'))).toLower(); - QString fname = m_imagesDir.absoluteFilePath(image->attributeName() + QLatin1Char('.') + extension); - - *m_output << " images/" << image->attributeName() << QLatin1Char('.') + extension << "\n"; - - QFile f; - f.setFileName(fname); - const bool isXPM_GZ = format == QLatin1String("XPM.GZ"); - QIODevice::OpenMode openMode = QIODevice::WriteOnly; - if (isXPM_GZ) - openMode |= QIODevice::Text; - if (!f.open(openMode)) { - fprintf(stderr, "%s: Error: Could not create image file %s: %s", - qPrintable(m_option.messagePrefix()), - qPrintable(fname), qPrintable(f.errorString())); - return; - } - - if (isXPM_GZ) { - QTextStream *imageOut = new QTextStream(&f); -#ifndef QT_NO_TEXTCODEC - imageOut->setCodec(QTextCodec::codecForName("UTF-8")); -#endif - - CPP::WriteIconData::writeImage(*imageOut, QString(), m_option.limitXPM_LineLength, image); - delete imageOut; - } else { - CPP::WriteIconData::writeImage(f, image); - } - - f.close(); -} - -} // namespace CPP - -QT_END_NAMESPACE diff --git a/src/tools/uic/cpp/cppextractimages.h b/src/tools/uic/cpp/cppextractimages.h deleted file mode 100644 index d012de8d0a..0000000000 --- a/src/tools/uic/cpp/cppextractimages.h +++ /dev/null @@ -1,64 +0,0 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ - -#ifndef CPPEXTRACTIMAGES_H -#define CPPEXTRACTIMAGES_H - -#include "treewalker.h" -#include - -QT_BEGIN_NAMESPACE - -class QTextStream; -class Driver; -class Uic; - -struct Option; - -namespace CPP { - -class ExtractImages : public TreeWalker -{ -public: - ExtractImages(const Option &opt); - - void acceptUI(DomUI *node) Q_DECL_OVERRIDE; - void acceptImages(DomImages *images) Q_DECL_OVERRIDE; - void acceptImage(DomImage *image) Q_DECL_OVERRIDE; - -private: - QTextStream *m_output; - const Option &m_option; - QDir m_imagesDir; -}; - -} // namespace CPP - -QT_END_NAMESPACE - -#endif // CPPEXTRACTIMAGES_H diff --git a/src/tools/uic/cpp/cppwritedeclaration.cpp b/src/tools/uic/cpp/cppwritedeclaration.cpp index 3aadc878e3..e384a1e194 100644 --- a/src/tools/uic/cpp/cppwritedeclaration.cpp +++ b/src/tools/uic/cpp/cppwritedeclaration.cpp @@ -27,10 +27,7 @@ ****************************************************************************/ #include "cppwritedeclaration.h" -#include "cppwriteicondeclaration.h" #include "cppwriteinitialization.h" -#include "cppwriteiconinitialization.h" -#include "cppextractimages.h" #include "driver.h" #include "ui4.h" #include "uic.h" @@ -56,47 +53,15 @@ namespace { output << "} // namespace " << *it << "\n"; } } - - void writeScriptContextClass(const QString &indent, QTextStream &str) { - str << indent << "class ScriptContext\n" - << indent << "{\n" - << indent << "public:\n" - << indent << " void run(const QString &script, QWidget *widget, const QWidgetList &childWidgets)\n" - << indent << " {\n" - << indent << " QScriptValue widgetObject = scriptEngine.newQObject(widget);\n" - << indent << " QScriptValue childWidgetArray = scriptEngine.newArray (childWidgets.size());\n" - << indent << " for (int i = 0; i < childWidgets.size(); i++)\n" - << indent << " childWidgetArray.setProperty(i, scriptEngine.newQObject(childWidgets[i]));\n" - << indent << " QScriptContext *ctx = scriptEngine.pushContext();\n" - << indent << " ctx ->activationObject().setProperty(QLatin1String(\"widget\"), widgetObject);\n" - << indent << " ctx ->activationObject().setProperty(QLatin1String(\"childWidgets\"), childWidgetArray);\n\n" - << indent << " scriptEngine.evaluate(script);\n" - << indent << " if (scriptEngine.hasUncaughtException ()) {\n" - << indent << " qWarning() << \"An exception occurred at line \" << scriptEngine.uncaughtExceptionLineNumber()\n" - << indent << " << \" of the script for \" << widget->objectName() << \": \" << engineError() << '\\n'\n" - << indent << " << script;\n" - << indent << " }\n\n" - << indent << " scriptEngine.popContext();\n" - << indent << " }\n\n" - << indent << "private:\n" - << indent << " QString engineError()\n" - << indent << " {\n" - << indent << " QScriptValue error = scriptEngine.evaluate(\"Error\");\n" - << indent << " return error.toString();\n" - << indent << " }\n\n" - << indent << " QScriptEngine scriptEngine;\n" - << indent << "};\n\n"; - } } namespace CPP { -WriteDeclaration::WriteDeclaration(Uic *uic, bool activateScripts) : +WriteDeclaration::WriteDeclaration(Uic *uic) : m_uic(uic), m_driver(uic->driver()), m_output(uic->output()), - m_option(uic->option()), - m_activateScripts(activateScripts) + m_option(uic->option()) { } @@ -154,29 +119,7 @@ void WriteDeclaration::acceptUI(DomUI *node) m_output << "\n"; - WriteInitialization(m_uic, m_activateScripts).acceptUI(node); - - if (node->elementImages()) { - if (m_option.extractImages) { - ExtractImages(m_uic->option()).acceptUI(node); - } else { - m_output << "\n" - << "protected:\n" - << m_option.indent << "enum IconID\n" - << m_option.indent << "{\n"; - WriteIconDeclaration(m_uic).acceptUI(node); - - m_output << m_option.indent << m_option.indent << "unknown_ID\n" - << m_option.indent << "};\n"; - - WriteIconInitialization(m_uic).acceptUI(node); - } - } - - if (m_activateScripts) { - m_output << "\nprivate:\n\n"; - writeScriptContextClass(m_option.indent, m_output); - } + WriteInitialization(m_uic).acceptUI(node); m_output << "};\n\n"; diff --git a/src/tools/uic/cpp/cppwritedeclaration.h b/src/tools/uic/cpp/cppwritedeclaration.h index baa57c5978..ca2122293c 100644 --- a/src/tools/uic/cpp/cppwritedeclaration.h +++ b/src/tools/uic/cpp/cppwritedeclaration.h @@ -43,7 +43,7 @@ namespace CPP { struct WriteDeclaration : public TreeWalker { - WriteDeclaration(Uic *uic, bool activateScripts); + WriteDeclaration(Uic *uic); void acceptUI(DomUI *node) Q_DECL_OVERRIDE; void acceptWidget(DomWidget *node) Q_DECL_OVERRIDE; @@ -58,7 +58,6 @@ private: Driver *m_driver; QTextStream &m_output; const Option &m_option; - const bool m_activateScripts; }; } // namespace CPP diff --git a/src/tools/uic/cpp/cppwriteicondata.cpp b/src/tools/uic/cpp/cppwriteicondata.cpp deleted file mode 100644 index 4601a4c5e9..0000000000 --- a/src/tools/uic/cpp/cppwriteicondata.cpp +++ /dev/null @@ -1,172 +0,0 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ - -#include "cppwriteicondata.h" -#include "driver.h" -#include "ui4.h" -#include "uic.h" - -#include - -QT_BEGIN_NAMESPACE - -namespace CPP { - -static QByteArray transformImageData(const QString &data) -{ - int baSize = data.length() / 2; - uchar *ba = new uchar[baSize]; - for (int i = 0; i < baSize; ++i) { - char h = data[2 * (i)].toLatin1(); - char l = data[2 * (i) + 1].toLatin1(); - uchar r = 0; - if (h <= '9') - r += h - '0'; - else - r += h - 'a' + 10; - r = r << 4; - if (l <= '9') - r += l - '0'; - else - r += l - 'a' + 10; - ba[i] = r; - } - QByteArray ret(reinterpret_cast(ba), baSize); - delete [] ba; - return ret; -} - -static QByteArray unzipXPM(const QString &data, ulong &length) -{ -#ifndef QT_NO_COMPRESS - const int lengthOffset = 4; - QByteArray ba(lengthOffset, ' '); - - // qUncompress() expects the first 4 bytes to be the expected length of the - // uncompressed data - ba[0] = (length & 0xff000000) >> 24; - ba[1] = (length & 0x00ff0000) >> 16; - ba[2] = (length & 0x0000ff00) >> 8; - ba[3] = (length & 0x000000ff); - ba.append(transformImageData(data)); - QByteArray baunzip = qUncompress(ba); - return baunzip; -#else - Q_UNUSED(data); - Q_UNUSED(length); - return QByteArray(); -#endif -} - - -WriteIconData::WriteIconData(Uic *uic) - : driver(uic->driver()), output(uic->output()), option(uic->option()) -{ -} - -void WriteIconData::acceptUI(DomUI *node) -{ - TreeWalker::acceptUI(node); -} - -void WriteIconData::acceptImages(DomImages *images) -{ - TreeWalker::acceptImages(images); -} - -void WriteIconData::acceptImage(DomImage *image) -{ - // Limit line length when writing code. - writeImage(output, option.indent, true, image); -} - -void WriteIconData::writeImage(QTextStream &output, const QString &indent, - bool limitXPM_LineLength, const DomImage *image) -{ - QString img = image->attributeName() + QLatin1String("_data"); - QString data = image->elementData()->text(); - QString fmt = image->elementData()->attributeFormat(); - int size = image->elementData()->attributeLength(); - - if (fmt == QLatin1String("XPM.GZ")) { - ulong length = size; - QByteArray baunzip = unzipXPM(data, length); - length = baunzip.size(); - // shouldn't we test the initial 'length' against the - // resulting 'length' to catch corrupt UIC files? - int a = 0; - int column = 0; - bool inQuote = false; - output << indent << "/* XPM */\n" - << indent << "static const char* const " << img << "[] = { \n"; - while (baunzip[a] != '\"') - a++; - for (; a < (int) length; a++) { - output << baunzip[a]; - if (baunzip[a] == '\n') { - column = 0; - } else if (baunzip[a] == '"') { - inQuote = !inQuote; - } - - column++; - if (limitXPM_LineLength && column >= 512 && inQuote) { - output << "\"\n\""; // be nice with MSVC & Co. - column = 1; - } - } - - if (! baunzip.trimmed ().endsWith ("};")) - output << "};"; - - output << "\n\n"; - } else { - output << indent << "static const unsigned char " << img << "[] = { \n"; - output << indent; - int a ; - for (a = 0; a < (int) (data.length()/2)-1; a++) { - output << "0x" << QString(data[2*a]) << QString(data[2*a+1]) << ','; - if (a % 12 == 11) - output << '\n' << indent; - else - output << ' '; - } - output << "0x" << QString(data[2*a]) << QString(data[2*a+1]) << '\n'; - output << "};\n\n"; - } -} - -void WriteIconData::writeImage(QIODevice &output, DomImage *image) -{ - const QByteArray array = transformImageData(image->elementData()->text()); - output.write(array.constData(), array.size()); -} - -} // namespace CPP - -QT_END_NAMESPACE diff --git a/src/tools/uic/cpp/cppwriteicondata.h b/src/tools/uic/cpp/cppwriteicondata.h deleted file mode 100644 index c496d5a85b..0000000000 --- a/src/tools/uic/cpp/cppwriteicondata.h +++ /dev/null @@ -1,68 +0,0 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ - -#ifndef CPPWRITEICONDATA_H -#define CPPWRITEICONDATA_H - -#include "treewalker.h" - -QT_BEGIN_NAMESPACE - -class QTextStream; -class QIODevice; -class Driver; -class Uic; - -struct Option; - -namespace CPP { - -class WriteIconData : public TreeWalker -{ -public: - WriteIconData(Uic *uic); - - void acceptUI(DomUI *node) Q_DECL_OVERRIDE; - void acceptImages(DomImages *images) Q_DECL_OVERRIDE; - void acceptImage(DomImage *image) Q_DECL_OVERRIDE; - - static void writeImage(QTextStream &output, const QString &indent, - bool limitXPM_LineLength, const DomImage *image); - static void writeImage(QIODevice &output, DomImage *image); - -private: - Driver *driver; - QTextStream &output; - const Option &option; -}; - -} // namespace CPP - -QT_END_NAMESPACE - -#endif // CPPWRITEICONDATA_H diff --git a/src/tools/uic/cpp/cppwriteicondeclaration.cpp b/src/tools/uic/cpp/cppwriteicondeclaration.cpp deleted file mode 100644 index 5264e3de54..0000000000 --- a/src/tools/uic/cpp/cppwriteicondeclaration.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ - -#include "cppwriteicondeclaration.h" -#include "driver.h" -#include "ui4.h" -#include "uic.h" - -#include - -QT_BEGIN_NAMESPACE - -namespace CPP { - -WriteIconDeclaration::WriteIconDeclaration(Uic *uic) - : driver(uic->driver()), output(uic->output()), option(uic->option()) -{ -} - -void WriteIconDeclaration::acceptUI(DomUI *node) -{ - TreeWalker::acceptUI(node); -} - -void WriteIconDeclaration::acceptImages(DomImages *images) -{ - TreeWalker::acceptImages(images); -} - -void WriteIconDeclaration::acceptImage(DomImage *image) -{ - QString name = image->attributeName(); - if (name.isEmpty()) - return; - - driver->insertPixmap(name); - output << option.indent << option.indent << name << "_ID,\n"; -} - -} // namespace CPP - -QT_END_NAMESPACE diff --git a/src/tools/uic/cpp/cppwriteicondeclaration.h b/src/tools/uic/cpp/cppwriteicondeclaration.h deleted file mode 100644 index 6483b8bf4a..0000000000 --- a/src/tools/uic/cpp/cppwriteicondeclaration.h +++ /dev/null @@ -1,63 +0,0 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ - -#ifndef CPPWRITEICONDECLARATION_H -#define CPPWRITEICONDECLARATION_H - -#include "treewalker.h" - -QT_BEGIN_NAMESPACE - -class QTextStream; -class Driver; -class Uic; - -struct Option; - -namespace CPP { - -class WriteIconDeclaration : public TreeWalker -{ -public: - WriteIconDeclaration(Uic *uic); - - void acceptUI(DomUI *node) Q_DECL_OVERRIDE; - void acceptImages(DomImages *images) Q_DECL_OVERRIDE; - void acceptImage(DomImage *image) Q_DECL_OVERRIDE; - -private: - Driver *driver; - QTextStream &output; - const Option &option; -}; - -} // namespace CPP - -QT_END_NAMESPACE - -#endif // CPPWRITEICONDECLARATION_H diff --git a/src/tools/uic/cpp/cppwriteiconinitialization.cpp b/src/tools/uic/cpp/cppwriteiconinitialization.cpp deleted file mode 100644 index 33d1c8402e..0000000000 --- a/src/tools/uic/cpp/cppwriteiconinitialization.cpp +++ /dev/null @@ -1,102 +0,0 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ - -#include "cppwriteiconinitialization.h" -#include "cppwriteicondata.h" -#include "driver.h" -#include "ui4.h" -#include "utils.h" -#include "uic.h" - -#include -#include - -QT_BEGIN_NAMESPACE - -namespace CPP { - -WriteIconInitialization::WriteIconInitialization(Uic *uic) - : driver(uic->driver()), output(uic->output()), option(uic->option()) -{ - this->uic = uic; -} - -void WriteIconInitialization::acceptUI(DomUI *node) -{ - if (node->elementImages() == 0) - return; - - QString className = node->elementClass() + option.postfix; - - output << option.indent << "static QPixmap " << iconFromDataFunction() << "(IconID id)\n" - << option.indent << "{\n"; - - WriteIconData(uic).acceptUI(node); - - output << option.indent << "switch (id) {\n"; - - TreeWalker::acceptUI(node); - - output << option.indent << option.indent << "default: return QPixmap();\n"; - - output << option.indent << "} // switch\n" - << option.indent << "} // icon\n\n"; -} - -QString WriteIconInitialization::iconFromDataFunction() -{ - return QLatin1String("qt_get_icon"); -} - -void WriteIconInitialization::acceptImages(DomImages *images) -{ - TreeWalker::acceptImages(images); -} - -void WriteIconInitialization::acceptImage(DomImage *image) -{ - QString img = image->attributeName() + QLatin1String("_data"); - QString data = image->elementData()->text(); - QString fmt = image->elementData()->attributeFormat(); - - QString imageId = image->attributeName() + QLatin1String("_ID"); - QString imageData = image->attributeName() + QLatin1String("_data"); - QString ind = option.indent + option.indent; - - output << ind << "case " << imageId << ": "; - - if (fmt == QLatin1String("XPM.GZ")) { - output << "return " << "QPixmap((const char**)" << imageData << ");\n"; - } else { - output << " { QImage img; img.loadFromData(" << imageData << ", sizeof(" << imageData << "), " << fixString(fmt, ind) << "); return QPixmap::fromImage(img); }\n"; - } -} - -} // namespace CPP - -QT_END_NAMESPACE diff --git a/src/tools/uic/cpp/cppwriteiconinitialization.h b/src/tools/uic/cpp/cppwriteiconinitialization.h deleted file mode 100644 index 588cb1bc67..0000000000 --- a/src/tools/uic/cpp/cppwriteiconinitialization.h +++ /dev/null @@ -1,68 +0,0 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ - -#ifndef CPPWRITEICONINITIALIZATION_H -#define CPPWRITEICONINITIALIZATION_H - -#include "treewalker.h" - -class QString; - -QT_BEGIN_NAMESPACE - -class QTextStream; -class Driver; -class Uic; - -struct Option; - -namespace CPP { - -class WriteIconInitialization : public TreeWalker -{ -public: - WriteIconInitialization(Uic *uic); - - void acceptUI(DomUI *node) Q_DECL_OVERRIDE; - void acceptImages(DomImages *images) Q_DECL_OVERRIDE; - void acceptImage(DomImage *image) Q_DECL_OVERRIDE; - - static QString iconFromDataFunction(); - -private: - Uic *uic; - Driver *driver; - QTextStream &output; - const Option &option; -}; - -} // namespace CPP - -QT_END_NAMESPACE - -#endif // CPPWRITEICONINITIALIZATION_H diff --git a/src/tools/uic/cpp/cppwriteincludes.cpp b/src/tools/uic/cpp/cppwriteincludes.cpp index dcbe400224..de64b85219 100644 --- a/src/tools/uic/cpp/cppwriteincludes.cpp +++ b/src/tools/uic/cpp/cppwriteincludes.cpp @@ -69,7 +69,7 @@ static inline QString moduleHeader(const QString &module, const QString &header) namespace CPP { WriteIncludes::WriteIncludes(Uic *uic) - : m_uic(uic), m_output(uic->output()), m_scriptsActivated(false), m_laidOut(false) + : m_uic(uic), m_output(uic->output()), m_laidOut(false) { // When possible (no namespace) use the "QtModule/QClass" convention // and create a re-mapping of the old header "qclass.h" to it. Do not do this @@ -92,7 +92,6 @@ WriteIncludes::WriteIncludes(Uic *uic) void WriteIncludes::acceptUI(DomUI *node) { - m_scriptsActivated = false; m_laidOut = false; m_localIncludes.clear(); m_globalIncludes.clear(); @@ -231,10 +230,6 @@ void WriteIncludes::acceptCustomWidget(DomCustomWidget *node) if (className.isEmpty()) return; - if (const DomScript *domScript = node->elementScript()) - if (!domScript->text().isEmpty()) - activateScripts(); - if (!node->elementHeader() || node->elementHeader()->text().isEmpty()) { add(className, false); // no header specified } else { @@ -296,21 +291,6 @@ void WriteIncludes::writeHeaders(const OrderedSet &headers, bool global) } } -void WriteIncludes::acceptWidgetScripts(const DomScripts &scripts, DomWidget *, const DomWidgets &) -{ - if (!scripts.empty()) { - activateScripts(); - } -} - -void WriteIncludes::activateScripts() -{ - if (!m_scriptsActivated) { - add(QLatin1String("QScriptEngine")); - add(QLatin1String("QDebug")); - m_scriptsActivated = true; - } -} } // namespace CPP QT_END_NAMESPACE diff --git a/src/tools/uic/cpp/cppwriteincludes.h b/src/tools/uic/cpp/cppwriteincludes.h index 7a6a499536..0d9c293efc 100644 --- a/src/tools/uic/cpp/cppwriteincludes.h +++ b/src/tools/uic/cpp/cppwriteincludes.h @@ -54,7 +54,6 @@ struct WriteIncludes : public TreeWalker void acceptLayout(DomLayout *node) Q_DECL_OVERRIDE; void acceptSpacer(DomSpacer *node) Q_DECL_OVERRIDE; void acceptProperty(DomProperty *node) Q_DECL_OVERRIDE; - void acceptWidgetScripts(const DomScripts &, DomWidget *, const DomWidgets &) Q_DECL_OVERRIDE; // // custom widgets @@ -68,8 +67,6 @@ struct WriteIncludes : public TreeWalker void acceptIncludes(DomIncludes *node) Q_DECL_OVERRIDE; void acceptInclude(DomInclude *node) Q_DECL_OVERRIDE; - bool scriptsActivated() const { return m_scriptsActivated; } - private: void add(const QString &className, bool determineHeader = true, const QString &header = QString(), bool global = false); @@ -79,7 +76,6 @@ private: void insertInclude(const QString &header, bool global); void writeHeaders(const OrderedSet &headers, bool global); QString headerForClassName(const QString &className) const; - void activateScripts(); const Uic *m_uic; QTextStream &m_output; @@ -94,7 +90,6 @@ private: StringMap m_classToHeader; StringMap m_oldHeaderToNewHeader; - bool m_scriptsActivated; bool m_laidOut; }; diff --git a/src/tools/uic/cpp/cppwriteinitialization.cpp b/src/tools/uic/cpp/cppwriteinitialization.cpp index 327e3500f2..2fb44952be 100644 --- a/src/tools/uic/cpp/cppwriteinitialization.cpp +++ b/src/tools/uic/cpp/cppwriteinitialization.cpp @@ -27,7 +27,6 @@ ****************************************************************************/ #include "cppwriteinitialization.h" -#include "cppwriteiconinitialization.h" #include "driver.h" #include "ui4.h" #include "utils.h" @@ -130,11 +129,6 @@ namespace { str << indent << varName << "->" << setter << '(' << v << ");\n"; } - void writeSetupUIScriptVariableDeclarations(const QString &indent, QTextStream &str) { - str << indent << "ScriptContext scriptContext;\n" - << indent << "QWidgetList childWidgets;\n"; - } - static inline bool iconHasStatePixmaps(const DomResourceIcon *i) { return i->hasElementNormalOff() || i->hasElementNormalOn() || i->hasElementDisabledOff() || i->hasElementDisabledOn() || @@ -464,7 +458,7 @@ static bool needsTranslation(const DomElement *element) } // --- WriteInitialization -WriteInitialization::WriteInitialization(Uic *uic, bool activateScripts) : +WriteInitialization::WriteInitialization(Uic *uic) : m_uic(uic), m_driver(uic->driver()), m_output(uic->output()), m_option(uic->option()), m_indent(m_option.indent + m_option.indent), @@ -475,14 +469,13 @@ WriteInitialization::WriteInitialization(Uic *uic, bool activateScripts) : m_delayedOut(&m_delayedInitialization, QIODevice::WriteOnly), m_refreshOut(&m_refreshInitialization, QIODevice::WriteOnly), m_actionOut(&m_delayedActionInitialization, QIODevice::WriteOnly), - m_activateScripts(activateScripts), m_layoutWidget(false), + m_layoutWidget(false), m_firstThemeIcon(true) { } void WriteInitialization::acceptUI(DomUI *node) { - m_registeredImages.clear(); m_actionGroupChain.push(0); m_widgetChain.push(0); m_layoutChain.push(0); @@ -493,9 +486,6 @@ void WriteInitialization::acceptUI(DomUI *node) if (node->elementCustomWidgets()) TreeWalker::acceptCustomWidgets(node->elementCustomWidgets()); - if (node->elementImages()) - TreeWalker::acceptImages(node->elementImages()); - if (m_option.generateImplemetation) m_output << "#include <" << m_driver->headerFileName() << ">\n\n"; @@ -515,9 +505,6 @@ void WriteInitialization::acceptUI(DomUI *node) m_output << m_option.indent << "void " << "setupUi(" << widgetClassName << " *" << varName << ")\n" << m_option.indent << "{\n"; - if (m_activateScripts) - writeSetupUIScriptVariableDeclarations(m_indent, m_output); - const QStringList connections = m_uic->databaseInfo()->connections(); for (int i=0; ielementData()->attributeFormat(); - const QString extension = format.left(format.indexOf(QLatin1Char('.'))).toLower(); - return QLatin1String("QPixmap(QString::fromUtf8(\":/") - + m_generatedClass - + QLatin1String("/images/") - + text - + QLatin1Char('.') - + extension - + QLatin1String("\"))"); - } - return WriteIconInitialization::iconFromDataFunction() - + QLatin1Char('(') - + text - + QLatin1String("_ID)"); - } QString pixFunc = m_uic->pixmapFunction(); if (pixFunc.isEmpty()) @@ -2429,11 +2399,6 @@ void WriteInitialization::acceptConnection(DomConnection *connection) << ");\n"; } -DomImage *WriteInitialization::findImage(const QString &name) const -{ - return m_registeredImages.value(name); -} - DomWidget *WriteInitialization::findWidget(QLatin1String widgetClass) { for (int i = m_widgetChain.count() - 1; i >= 0; --i) { @@ -2446,49 +2411,6 @@ DomWidget *WriteInitialization::findWidget(QLatin1String widgetClass) return 0; } -void WriteInitialization::acceptImage(DomImage *image) -{ - if (!image->hasAttributeName()) - return; - - m_registeredImages.insert(image->attributeName(), image); -} - -void WriteInitialization::acceptWidgetScripts(const DomScripts &widgetScripts, DomWidget *node, const DomWidgets &childWidgets) -{ - // Add the per-class custom scripts to the per-widget ones. - DomScripts scripts(widgetScripts); - - if (DomScript *customWidgetScript = m_uic->customWidgetsInfo()->customWidgetScript(node->attributeClass())) - scripts.push_front(customWidgetScript); - - if (scripts.empty()) - return; - - // concatenate script snippets - QString script; - for (const DomScript *domScript : qAsConst(scripts)) { - const QString snippet = domScript->text(); - if (!snippet.isEmpty()) - script += QStringRef(&snippet).trimmed() + QLatin1Char('\n'); - } - if (script.isEmpty()) - return; - - // Build the list of children and insert call - m_output << m_indent << "childWidgets.clear();\n"; - if (!childWidgets.empty()) { - m_output << m_indent << "childWidgets"; - for (DomWidget *child : childWidgets) - m_output << " << " << m_driver->findOrInsertWidget(child); - m_output << ";\n"; - } - m_output << m_indent << "scriptContext.run(" - << writeString(script, m_dindent) << ", " - << m_driver->findOrInsertWidget(node) << ", childWidgets);\n"; -} - - static void generateMultiDirectiveBegin(QTextStream &outputStream, const QSet &directives) { if (directives.isEmpty()) diff --git a/src/tools/uic/cpp/cppwriteinitialization.h b/src/tools/uic/cpp/cppwriteinitialization.h index 5e7ec200b7..187ba8378e 100644 --- a/src/tools/uic/cpp/cppwriteinitialization.h +++ b/src/tools/uic/cpp/cppwriteinitialization.h @@ -88,14 +88,13 @@ struct WriteInitialization : public TreeWalker typedef QList DomPropertyList; typedef QHash DomPropertyMap; - WriteInitialization(Uic *uic, bool activateScripts); + WriteInitialization(Uic *uic); // // widgets // void acceptUI(DomUI *node) Q_DECL_OVERRIDE; void acceptWidget(DomWidget *node) Q_DECL_OVERRIDE; - void acceptWidgetScripts(const DomScripts &, DomWidget *node, const DomWidgets &childWidgets) Q_DECL_OVERRIDE; void acceptLayout(DomLayout *node) Q_DECL_OVERRIDE; void acceptSpacer(DomSpacer *node) Q_DECL_OVERRIDE; @@ -130,11 +129,6 @@ struct WriteInitialization : public TreeWalker // void acceptConnection(DomConnection *connection) Q_DECL_OVERRIDE; -// -// images -// - void acceptImage(DomImage *image) Q_DECL_OVERRIDE; - enum { Use43UiFile = 0, TopLevelMargin, @@ -229,7 +223,6 @@ private: QString findDeclaration(const QString &name); DomWidget *findWidget(QLatin1String widgetClass); - DomImage *findImage(const QString &name) const; bool isValidObject(const QString &name) const; @@ -263,7 +256,6 @@ private: QSet m_buttonGroups; QHash m_registeredWidgets; - QHash m_registeredImages; QHash m_registeredActions; typedef QHash ColorBrushHash; ColorBrushHash m_colorBrushHash; @@ -314,7 +306,6 @@ private: QString m_delayedActionInitialization; QTextStream m_actionOut; - const bool m_activateScripts; bool m_layoutWidget; bool m_firstThemeIcon; diff --git a/src/tools/uic/customwidgetsinfo.cpp b/src/tools/uic/customwidgetsinfo.cpp index 662a249d71..6883b715ae 100644 --- a/src/tools/uic/customwidgetsinfo.cpp +++ b/src/tools/uic/customwidgetsinfo.cpp @@ -91,18 +91,6 @@ QString CustomWidgetsInfo::realClassName(const QString &className) const return className; } -DomScript *CustomWidgetsInfo::customWidgetScript(const QString &name) const -{ - if (m_customWidgets.empty()) - return 0; - - const NameCustomWidgetMap::const_iterator it = m_customWidgets.constFind(name); - if (it == m_customWidgets.constEnd()) - return 0; - - return it.value()->elementScript(); -} - QString CustomWidgetsInfo::customWidgetAddPageMethod(const QString &name) const { if (DomCustomWidget *dcw = m_customWidgets.value(name, 0)) diff --git a/src/tools/uic/customwidgetsinfo.h b/src/tools/uic/customwidgetsinfo.h index 7bc2b62619..3ce27d546c 100644 --- a/src/tools/uic/customwidgetsinfo.h +++ b/src/tools/uic/customwidgetsinfo.h @@ -57,8 +57,6 @@ public: inline DomCustomWidget *customWidget(const QString &name) const { return m_customWidgets.value(name); } - DomScript *customWidgetScript(const QString &name) const; - QString customWidgetAddPageMethod(const QString &name) const; QString realClassName(const QString &className) const; diff --git a/src/tools/uic/option.h b/src/tools/uic/option.h index 1483d94c07..a5b14abc5f 100644 --- a/src/tools/uic/option.h +++ b/src/tools/uic/option.h @@ -48,7 +48,6 @@ struct Option unsigned int generateNamespace : 1; unsigned int autoConnection : 1; unsigned int dependencies : 1; - unsigned int extractImages : 1; unsigned int limitXPM_LineLength : 1; unsigned int implicitIncludes: 1; unsigned int idBased: 1; @@ -74,7 +73,6 @@ struct Option generateNamespace(1), autoConnection(1), dependencies(0), - extractImages(0), limitXPM_LineLength(0), implicitIncludes(1), idBased(0), diff --git a/src/tools/uic/treewalker.cpp b/src/tools/uic/treewalker.cpp index 044d0f0228..4c9981580b 100644 --- a/src/tools/uic/treewalker.cpp +++ b/src/tools/uic/treewalker.cpp @@ -38,9 +38,6 @@ void TreeWalker::acceptUI(DomUI *ui) acceptButtonGroups(domButtonGroups); acceptTabStops(ui->elementTabStops()); - - if (ui->elementImages()) - acceptImages(ui->elementImages()); } void TreeWalker::acceptLayoutDefault(DomLayoutDefault *layoutDefault) @@ -112,8 +109,6 @@ void TreeWalker::acceptWidget(DomWidget *widget) if (!widget->elementLayout().isEmpty()) acceptLayout(widget->elementLayout().at(0)); - - acceptWidgetScripts(widget->elementScript(), widget, childWidgets); } void TreeWalker::acceptSpacer(DomSpacer *spacer) @@ -250,17 +245,6 @@ void TreeWalker::acceptActionRef(DomActionRef *actionRef) Q_UNUSED(actionRef); } -void TreeWalker::acceptImages(DomImages *images) -{ - for (int i=0; ielementImage().size(); ++i) - acceptImage(images->elementImage().at(i)); -} - -void TreeWalker::acceptImage(DomImage *image) -{ - Q_UNUSED(image); -} - void TreeWalker::acceptIncludes(DomIncludes *includes) { for (int i=0; ielementInclude().size(); ++i) @@ -294,10 +278,6 @@ void TreeWalker::acceptConnectionHint(DomConnectionHint *connectionHint) Q_UNUSED(connectionHint); } -void TreeWalker::acceptWidgetScripts(const DomScripts &, DomWidget *, const DomWidgets &) -{ -} - void TreeWalker::acceptButtonGroups(const DomButtonGroups *domButtonGroups) { const auto &domGroups = domButtonGroups->elementButtonGroup(); diff --git a/src/tools/uic/treewalker.h b/src/tools/uic/treewalker.h index 8f80880dd0..78da17d628 100644 --- a/src/tools/uic/treewalker.h +++ b/src/tools/uic/treewalker.h @@ -103,9 +103,6 @@ struct TreeWalker virtual void acceptProperty(DomProperty *property); typedef QVector DomScripts; typedef QVector DomWidgets; - virtual void acceptWidgetScripts(const DomScripts &, DomWidget *node, const DomWidgets &childWidgets); - virtual void acceptImages(DomImages *images); - virtual void acceptImage(DomImage *image); virtual void acceptIncludes(DomIncludes *includes); virtual void acceptInclude(DomInclude *incl); virtual void acceptAction(DomAction *action); diff --git a/src/tools/uic/ui4.cpp b/src/tools/uic/ui4.cpp index 49e7f21633..57400c1e3c 100644 --- a/src/tools/uic/ui4.cpp +++ b/src/tools/uic/ui4.cpp @@ -39,31 +39,6 @@ using namespace QFormInternal; /******************************************************************************* ** Implementations */ - -DomUI::DomUI() -{ - m_children = 0; - m_has_attr_version = false; - m_has_attr_language = false; - m_has_attr_displayname = false; - m_has_attr_stdsetdef = false; - m_attr_stdsetdef = 0; - m_has_attr_stdSetDef = false; - m_attr_stdSetDef = 0; - m_widget = 0; - m_layoutDefault = 0; - m_layoutFunction = 0; - m_customWidgets = 0; - m_tabStops = 0; - m_images = 0; - m_includes = 0; - m_resources = 0; - m_connections = 0; - m_designerdata = 0; - m_slots = 0; - m_buttonGroups = 0; -} - DomUI::~DomUI() { delete m_widget; @@ -71,7 +46,6 @@ DomUI::~DomUI() delete m_layoutFunction; delete m_customWidgets; delete m_tabStops; - delete m_images; delete m_includes; delete m_resources; delete m_connections; @@ -162,12 +136,6 @@ void DomUI::read(QXmlStreamReader &reader) setElementTabStops(v); continue; } - if (!tag.compare(QLatin1String("images"), Qt::CaseInsensitive)) { - DomImages *v = new DomImages(); - v->read(reader); - setElementImages(v); - continue; - } if (!tag.compare(QLatin1String("includes"), Qt::CaseInsensitive)) { DomIncludes *v = new DomIncludes(); v->read(reader); @@ -209,10 +177,6 @@ void DomUI::read(QXmlStreamReader &reader) break; case QXmlStreamReader::EndElement : return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; default : break; } @@ -268,9 +232,6 @@ void DomUI::write(QXmlStreamWriter &writer, const QString &tagName) const if (m_children & TabStops) m_tabStops->write(writer, QStringLiteral("tabstops")); - if (m_children & Images) - m_images->write(writer, QStringLiteral("images")); - if (m_children & Includes) m_includes->write(writer, QStringLiteral("includes")); @@ -289,9 +250,6 @@ void DomUI::write(QXmlStreamWriter &writer, const QString &tagName) const if (m_children & ButtonGroups) m_buttonGroups->write(writer, QStringLiteral("buttongroups")); - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - writer.writeEndElement(); } @@ -400,21 +358,6 @@ void DomUI::setElementTabStops(DomTabStops *a) m_tabStops = a; } -DomImages *DomUI::takeElementImages() -{ - DomImages *a = m_images; - m_images = 0; - m_children ^= Images; - return a; -} - -void DomUI::setElementImages(DomImages *a) -{ - delete m_images; - m_children |= Images; - m_images = a; -} - DomIncludes *DomUI::takeElementIncludes() { DomIncludes *a = m_includes; @@ -565,13 +508,6 @@ void DomUI::clearElementTabStops() m_children &= ~TabStops; } -void DomUI::clearElementImages() -{ - delete m_images; - m_images = 0; - m_children &= ~Images; -} - void DomUI::clearElementIncludes() { delete m_includes; @@ -614,11 +550,6 @@ void DomUI::clearElementButtonGroups() m_children &= ~ButtonGroups; } -DomIncludes::DomIncludes() -{ - m_children = 0; -} - DomIncludes::~DomIncludes() { qDeleteAll(m_include); @@ -642,10 +573,6 @@ void DomIncludes::read(QXmlStreamReader &reader) break; case QXmlStreamReader::EndElement : return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; default : break; } @@ -659,9 +586,6 @@ void DomIncludes::write(QXmlStreamWriter &writer, const QString &tagName) const for (DomInclude *v : m_include) v->write(writer, QStringLiteral("include")); - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - writer.writeEndElement(); } @@ -671,13 +595,6 @@ void DomIncludes::setElementInclude(const QVector &a) m_include = a; } -DomInclude::DomInclude() -{ - m_has_attr_location = false; - m_has_attr_impldecl = false; - m_text.clear(); -} - DomInclude::~DomInclude() { } @@ -733,12 +650,6 @@ void DomInclude::write(QXmlStreamWriter &writer, const QString &tagName) const writer.writeEndElement(); } -DomResources::DomResources() -{ - m_children = 0; - m_has_attr_name = false; -} - DomResources::~DomResources() { qDeleteAll(m_include); @@ -772,10 +683,6 @@ void DomResources::read(QXmlStreamReader &reader) break; case QXmlStreamReader::EndElement : return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; default : break; } @@ -792,9 +699,6 @@ void DomResources::write(QXmlStreamWriter &writer, const QString &tagName) const for (DomResource *v : m_include) v->write(writer, QStringLiteral("include")); - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - writer.writeEndElement(); } @@ -804,11 +708,6 @@ void DomResources::setElementInclude(const QVector &a) m_include = a; } -DomResource::DomResource() -{ - m_has_attr_location = false; -} - DomResource::~DomResource() { } @@ -834,10 +733,6 @@ void DomResource::read(QXmlStreamReader &reader) break; case QXmlStreamReader::EndElement : return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; default : break; } @@ -851,18 +746,9 @@ void DomResource::write(QXmlStreamWriter &writer, const QString &tagName) const if (hasAttributeLocation()) writer.writeAttribute(QStringLiteral("location"), attributeLocation()); - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - writer.writeEndElement(); } -DomActionGroup::DomActionGroup() -{ - m_children = 0; - m_has_attr_name = false; -} - DomActionGroup::~DomActionGroup() { qDeleteAll(m_action); @@ -920,10 +806,6 @@ void DomActionGroup::read(QXmlStreamReader &reader) break; case QXmlStreamReader::EndElement : return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; default : break; } @@ -949,9 +831,6 @@ void DomActionGroup::write(QXmlStreamWriter &writer, const QString &tagName) con for (DomProperty *v : m_attribute) v->write(writer, QStringLiteral("attribute")); - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - writer.writeEndElement(); } @@ -979,13 +858,6 @@ void DomActionGroup::setElementAttribute(const QList &a) m_attribute = a; } -DomAction::DomAction() -{ - m_children = 0; - m_has_attr_name = false; - m_has_attr_menu = false; -} - DomAction::~DomAction() { qDeleteAll(m_property); @@ -1031,10 +903,6 @@ void DomAction::read(QXmlStreamReader &reader) break; case QXmlStreamReader::EndElement : return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; default : break; } @@ -1057,9 +925,6 @@ void DomAction::write(QXmlStreamWriter &writer, const QString &tagName) const for (DomProperty *v : m_attribute) v->write(writer, QStringLiteral("attribute")); - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - writer.writeEndElement(); } @@ -1075,11 +940,6 @@ void DomAction::setElementAttribute(const QList &a) m_attribute = a; } -DomActionRef::DomActionRef() -{ - m_has_attr_name = false; -} - DomActionRef::~DomActionRef() { } @@ -1105,10 +965,6 @@ void DomActionRef::read(QXmlStreamReader &reader) break; case QXmlStreamReader::EndElement : return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; default : break; } @@ -1122,18 +978,9 @@ void DomActionRef::write(QXmlStreamWriter &writer, const QString &tagName) const if (hasAttributeName()) writer.writeAttribute(QStringLiteral("name"), attributeName()); - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - writer.writeEndElement(); } -DomButtonGroup::DomButtonGroup() -{ - m_children = 0; - m_has_attr_name = false; -} - DomButtonGroup::~DomButtonGroup() { qDeleteAll(m_property); @@ -1175,10 +1022,6 @@ void DomButtonGroup::read(QXmlStreamReader &reader) break; case QXmlStreamReader::EndElement : return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; default : break; } @@ -1198,9 +1041,6 @@ void DomButtonGroup::write(QXmlStreamWriter &writer, const QString &tagName) con for (DomProperty *v : m_attribute) v->write(writer, QStringLiteral("attribute")); - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - writer.writeEndElement(); } @@ -1216,11 +1056,6 @@ void DomButtonGroup::setElementAttribute(const QList &a) m_attribute = a; } -DomButtonGroups::DomButtonGroups() -{ - m_children = 0; -} - DomButtonGroups::~DomButtonGroups() { qDeleteAll(m_buttonGroup); @@ -1244,10 +1079,6 @@ void DomButtonGroups::read(QXmlStreamReader &reader) break; case QXmlStreamReader::EndElement : return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; default : break; } @@ -1261,9 +1092,6 @@ void DomButtonGroups::write(QXmlStreamWriter &writer, const QString &tagName) co for (DomButtonGroup *v : m_buttonGroup) v->write(writer, QStringLiteral("buttongroup")); - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - writer.writeEndElement(); } @@ -1273,218 +1101,6 @@ void DomButtonGroups::setElementButtonGroup(const QVector &a) m_buttonGroup = a; } -DomImages::DomImages() -{ - m_children = 0; -} - -DomImages::~DomImages() -{ - qDeleteAll(m_image); - m_image.clear(); -} - -void DomImages::read(QXmlStreamReader &reader) -{ - while (!reader.hasError()) { - switch (reader.readNext()) { - case QXmlStreamReader::StartElement : { - const QStringRef tag = reader.name(); - if (!tag.compare(QLatin1String("image"), Qt::CaseInsensitive)) { - DomImage *v = new DomImage(); - v->read(reader); - m_image.append(v); - continue; - } - 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 DomImages::write(QXmlStreamWriter &writer, const QString &tagName) const -{ - writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("images") : tagName.toLower()); - - for (DomImage *v : m_image) - v->write(writer, QStringLiteral("image")); - - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - - writer.writeEndElement(); -} - -void DomImages::setElementImage(const QVector &a) -{ - m_children |= Image; - m_image = a; -} - -DomImage::DomImage() -{ - m_children = 0; - m_has_attr_name = false; - m_data = 0; -} - -DomImage::~DomImage() -{ - delete m_data; -} - -void DomImage::read(QXmlStreamReader &reader) -{ - const QXmlStreamAttributes &attributes = reader.attributes(); - for (const QXmlStreamAttribute &attribute : attributes) { - const QStringRef 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 QStringRef tag = reader.name(); - if (!tag.compare(QLatin1String("data"), Qt::CaseInsensitive)) { - DomImageData *v = new DomImageData(); - v->read(reader); - setElementData(v); - continue; - } - 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 DomImage::write(QXmlStreamWriter &writer, const QString &tagName) const -{ - writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("image") : tagName.toLower()); - - if (hasAttributeName()) - writer.writeAttribute(QStringLiteral("name"), attributeName()); - - if (m_children & Data) - m_data->write(writer, QStringLiteral("data")); - - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - - writer.writeEndElement(); -} - -DomImageData *DomImage::takeElementData() -{ - DomImageData *a = m_data; - m_data = 0; - m_children ^= Data; - return a; -} - -void DomImage::setElementData(DomImageData *a) -{ - delete m_data; - m_children |= Data; - m_data = a; -} - -void DomImage::clearElementData() -{ - delete m_data; - m_data = 0; - m_children &= ~Data; -} - -DomImageData::DomImageData() -{ - m_has_attr_format = false; - m_has_attr_length = false; - m_attr_length = 0; - m_text.clear(); -} - -DomImageData::~DomImageData() -{ -} - -void DomImageData::read(QXmlStreamReader &reader) -{ - const QXmlStreamAttributes &attributes = reader.attributes(); - for (const QXmlStreamAttribute &attribute : attributes) { - const QStringRef name = attribute.name(); - if (name == QLatin1String("format")) { - setAttributeFormat(attribute.value().toString()); - continue; - } - if (name == QLatin1String("length")) { - setAttributeLength(attribute.value().toInt()); - continue; - } - reader.raiseError(QLatin1String("Unexpected attribute ") + name); - } - - while (!reader.hasError()) { - switch (reader.readNext()) { - case QXmlStreamReader::StartElement : { - const QStringRef 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 DomImageData::write(QXmlStreamWriter &writer, const QString &tagName) const -{ - writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("imagedata") : tagName.toLower()); - - if (hasAttributeFormat()) - writer.writeAttribute(QStringLiteral("format"), attributeFormat()); - - if (hasAttributeLength()) - writer.writeAttribute(QStringLiteral("length"), QString::number(attributeLength())); - - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - - writer.writeEndElement(); -} - -DomCustomWidgets::DomCustomWidgets() -{ - m_children = 0; -} - DomCustomWidgets::~DomCustomWidgets() { qDeleteAll(m_customWidget); @@ -1508,10 +1124,6 @@ void DomCustomWidgets::read(QXmlStreamReader &reader) break; case QXmlStreamReader::EndElement : return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; default : break; } @@ -1525,9 +1137,6 @@ void DomCustomWidgets::write(QXmlStreamWriter &writer, const QString &tagName) c for (DomCustomWidget *v : m_customWidget) v->write(writer, QStringLiteral("customwidget")); - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - writer.writeEndElement(); } @@ -1537,12 +1146,6 @@ void DomCustomWidgets::setElementCustomWidget(const QVector & m_customWidget = a; } -DomHeader::DomHeader() -{ - m_has_attr_location = false; - m_text.clear(); -} - DomHeader::~DomHeader() { } @@ -1591,26 +1194,10 @@ void DomHeader::write(QXmlStreamWriter &writer, const QString &tagName) const writer.writeEndElement(); } -DomCustomWidget::DomCustomWidget() -{ - m_children = 0; - m_header = 0; - m_sizeHint = 0; - m_container = 0; - m_sizePolicy = 0; - m_script = 0; - m_properties = 0; - m_slots = 0; - m_propertyspecifications = 0; -} - DomCustomWidget::~DomCustomWidget() { delete m_header; delete m_sizeHint; - delete m_sizePolicy; - delete m_script; - delete m_properties; delete m_slots; delete m_propertyspecifications; } @@ -1649,28 +1236,10 @@ void DomCustomWidget::read(QXmlStreamReader &reader) setElementContainer(reader.readElementText().toInt()); continue; } - if (!tag.compare(QLatin1String("sizepolicy"), Qt::CaseInsensitive)) { - DomSizePolicyData *v = new DomSizePolicyData(); - v->read(reader); - setElementSizePolicy(v); - continue; - } if (!tag.compare(QLatin1String("pixmap"), Qt::CaseInsensitive)) { setElementPixmap(reader.readElementText()); continue; } - if (!tag.compare(QLatin1String("script"), Qt::CaseInsensitive)) { - DomScript *v = new DomScript(); - v->read(reader); - setElementScript(v); - continue; - } - if (!tag.compare(QLatin1String("properties"), Qt::CaseInsensitive)) { - DomProperties *v = new DomProperties(); - v->read(reader); - setElementProperties(v); - continue; - } if (!tag.compare(QLatin1String("slots"), Qt::CaseInsensitive)) { DomSlots *v = new DomSlots(); v->read(reader); @@ -1688,10 +1257,6 @@ void DomCustomWidget::read(QXmlStreamReader &reader) break; case QXmlStreamReader::EndElement : return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; default : break; } @@ -1720,27 +1285,15 @@ void DomCustomWidget::write(QXmlStreamWriter &writer, const QString &tagName) co if (m_children & Container) writer.writeTextElement(QStringLiteral("container"), QString::number(m_container)); - if (m_children & SizePolicy) - m_sizePolicy->write(writer, QStringLiteral("sizepolicy")); - if (m_children & Pixmap) writer.writeTextElement(QStringLiteral("pixmap"), m_pixmap); - if (m_children & Script) - m_script->write(writer, QStringLiteral("script")); - - if (m_children & Properties) - m_properties->write(writer, QStringLiteral("properties")); - if (m_children & Slots) m_slots->write(writer, QStringLiteral("slots")); if (m_children & Propertyspecifications) m_propertyspecifications->write(writer, QStringLiteral("propertyspecifications")); - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - writer.writeEndElement(); } @@ -1798,57 +1351,12 @@ void DomCustomWidget::setElementContainer(int a) m_container = a; } -DomSizePolicyData *DomCustomWidget::takeElementSizePolicy() -{ - DomSizePolicyData *a = m_sizePolicy; - m_sizePolicy = 0; - m_children ^= SizePolicy; - return a; -} - -void DomCustomWidget::setElementSizePolicy(DomSizePolicyData *a) -{ - delete m_sizePolicy; - m_children |= SizePolicy; - m_sizePolicy = a; -} - void DomCustomWidget::setElementPixmap(const QString &a) { m_children |= Pixmap; m_pixmap = a; } -DomScript *DomCustomWidget::takeElementScript() -{ - DomScript *a = m_script; - m_script = 0; - m_children ^= Script; - return a; -} - -void DomCustomWidget::setElementScript(DomScript *a) -{ - delete m_script; - m_children |= Script; - m_script = a; -} - -DomProperties *DomCustomWidget::takeElementProperties() -{ - DomProperties *a = m_properties; - m_properties = 0; - m_children ^= Properties; - return a; -} - -void DomCustomWidget::setElementProperties(DomProperties *a) -{ - delete m_properties; - m_children |= Properties; - m_properties = a; -} - DomSlots *DomCustomWidget::takeElementSlots() { DomSlots *a = m_slots; @@ -1913,32 +1421,11 @@ void DomCustomWidget::clearElementContainer() m_children &= ~Container; } -void DomCustomWidget::clearElementSizePolicy() -{ - delete m_sizePolicy; - m_sizePolicy = 0; - m_children &= ~SizePolicy; -} - void DomCustomWidget::clearElementPixmap() { m_children &= ~Pixmap; } -void DomCustomWidget::clearElementScript() -{ - delete m_script; - m_script = 0; - m_children &= ~Script; -} - -void DomCustomWidget::clearElementProperties() -{ - delete m_properties; - m_properties = 0; - m_children &= ~Properties; -} - void DomCustomWidget::clearElementSlots() { delete m_slots; @@ -1953,202 +1440,6 @@ void DomCustomWidget::clearElementPropertyspecifications() m_children &= ~Propertyspecifications; } -DomProperties::DomProperties() -{ - m_children = 0; -} - -DomProperties::~DomProperties() -{ - qDeleteAll(m_property); - m_property.clear(); -} - -void DomProperties::read(QXmlStreamReader &reader) -{ - while (!reader.hasError()) { - switch (reader.readNext()) { - case QXmlStreamReader::StartElement : { - const QStringRef tag = reader.name(); - if (!tag.compare(QLatin1String("property"), Qt::CaseInsensitive)) { - DomPropertyData *v = new DomPropertyData(); - v->read(reader); - m_property.append(v); - continue; - } - 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 DomProperties::write(QXmlStreamWriter &writer, const QString &tagName) const -{ - writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("properties") : tagName.toLower()); - - for (DomPropertyData *v : m_property) - v->write(writer, QStringLiteral("property")); - - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - - writer.writeEndElement(); -} - -void DomProperties::setElementProperty(const QVector &a) -{ - m_children |= Property; - m_property = a; -} - -DomPropertyData::DomPropertyData() -{ - m_has_attr_type = false; -} - -DomPropertyData::~DomPropertyData() -{ -} - -void DomPropertyData::read(QXmlStreamReader &reader) -{ - const QXmlStreamAttributes &attributes = reader.attributes(); - for (const QXmlStreamAttribute &attribute : attributes) { - const QStringRef name = attribute.name(); - if (name == QLatin1String("type")) { - setAttributeType(attribute.value().toString()); - continue; - } - reader.raiseError(QLatin1String("Unexpected attribute ") + name); - } - - while (!reader.hasError()) { - switch (reader.readNext()) { - case QXmlStreamReader::StartElement : { - const QStringRef 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 DomPropertyData::write(QXmlStreamWriter &writer, const QString &tagName) const -{ - writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("propertydata") : tagName.toLower()); - - if (hasAttributeType()) - writer.writeAttribute(QStringLiteral("type"), attributeType()); - - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - - writer.writeEndElement(); -} - -DomSizePolicyData::DomSizePolicyData() -{ - m_children = 0; - m_horData = 0; - m_verData = 0; -} - -DomSizePolicyData::~DomSizePolicyData() -{ -} - -void DomSizePolicyData::read(QXmlStreamReader &reader) -{ - while (!reader.hasError()) { - switch (reader.readNext()) { - case QXmlStreamReader::StartElement : { - const QStringRef tag = reader.name(); - if (!tag.compare(QLatin1String("hordata"), Qt::CaseInsensitive)) { - setElementHorData(reader.readElementText().toInt()); - continue; - } - if (!tag.compare(QLatin1String("verdata"), Qt::CaseInsensitive)) { - setElementVerData(reader.readElementText().toInt()); - continue; - } - 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 DomSizePolicyData::write(QXmlStreamWriter &writer, const QString &tagName) const -{ - writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("sizepolicydata") : tagName.toLower()); - - if (m_children & HorData) - writer.writeTextElement(QStringLiteral("hordata"), QString::number(m_horData)); - - if (m_children & VerData) - writer.writeTextElement(QStringLiteral("verdata"), QString::number(m_verData)); - - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - - writer.writeEndElement(); -} - -void DomSizePolicyData::setElementHorData(int a) -{ - m_children |= HorData; - m_horData = a; -} - -void DomSizePolicyData::setElementVerData(int a) -{ - m_children |= VerData; - m_verData = a; -} - -void DomSizePolicyData::clearElementHorData() -{ - m_children &= ~HorData; -} - -void DomSizePolicyData::clearElementVerData() -{ - m_children &= ~VerData; -} - -DomLayoutDefault::DomLayoutDefault() -{ - m_has_attr_spacing = false; - m_attr_spacing = 0; - m_has_attr_margin = false; - m_attr_margin = 0; -} - DomLayoutDefault::~DomLayoutDefault() { } @@ -2178,10 +1469,6 @@ void DomLayoutDefault::read(QXmlStreamReader &reader) break; case QXmlStreamReader::EndElement : return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; default : break; } @@ -2198,18 +1485,9 @@ void DomLayoutDefault::write(QXmlStreamWriter &writer, const QString &tagName) c if (hasAttributeMargin()) writer.writeAttribute(QStringLiteral("margin"), QString::number(attributeMargin())); - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - writer.writeEndElement(); } -DomLayoutFunction::DomLayoutFunction() -{ - m_has_attr_spacing = false; - m_has_attr_margin = false; -} - DomLayoutFunction::~DomLayoutFunction() { } @@ -2239,10 +1517,6 @@ void DomLayoutFunction::read(QXmlStreamReader &reader) break; case QXmlStreamReader::EndElement : return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; default : break; } @@ -2259,17 +1533,9 @@ void DomLayoutFunction::write(QXmlStreamWriter &writer, const QString &tagName) if (hasAttributeMargin()) writer.writeAttribute(QStringLiteral("margin"), attributeMargin()); - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - writer.writeEndElement(); } -DomTabStops::DomTabStops() -{ - m_children = 0; -} - DomTabStops::~DomTabStops() { m_tabStop.clear(); @@ -2290,10 +1556,6 @@ void DomTabStops::read(QXmlStreamReader &reader) break; case QXmlStreamReader::EndElement : return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; default : break; } @@ -2307,9 +1569,6 @@ void DomTabStops::write(QXmlStreamWriter &writer, const QString &tagName) const for (const QString &v : m_tabStop) writer.writeTextElement(QStringLiteral("tabstop"), v); - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - writer.writeEndElement(); } @@ -2319,18 +1578,6 @@ void DomTabStops::setElementTabStop(const QStringList &a) m_tabStop = a; } -DomLayout::DomLayout() -{ - m_children = 0; - m_has_attr_class = false; - m_has_attr_name = false; - m_has_attr_stretch = false; - m_has_attr_rowStretch = false; - m_has_attr_columnStretch = false; - m_has_attr_rowMinimumHeight = false; - m_has_attr_columnMinimumWidth = false; -} - DomLayout::~DomLayout() { qDeleteAll(m_property); @@ -2404,10 +1651,6 @@ void DomLayout::read(QXmlStreamReader &reader) break; case QXmlStreamReader::EndElement : return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; default : break; } @@ -2448,9 +1691,6 @@ void DomLayout::write(QXmlStreamWriter &writer, const QString &tagName) const for (DomLayoutItem *v : m_item) v->write(writer, QStringLiteral("item")); - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - writer.writeEndElement(); } @@ -2472,6 +1712,13 @@ void DomLayout::setElementItem(const QVector &a) m_item = a; } +DomLayoutItem::~DomLayoutItem() +{ + delete m_widget; + delete m_layout; + delete m_spacer; +} + void DomLayoutItem::clear() { delete m_widget; @@ -2480,34 +1727,9 @@ void DomLayoutItem::clear() m_kind = Unknown; - m_widget = 0; - m_layout = 0; - m_spacer = 0; -} - -DomLayoutItem::DomLayoutItem() -{ - m_kind = Unknown; - - m_has_attr_row = false; - m_attr_row = 0; - m_has_attr_column = false; - m_attr_column = 0; - m_has_attr_rowSpan = false; - m_attr_rowSpan = 0; - m_has_attr_colSpan = false; - m_attr_colSpan = 0; - m_has_attr_alignment = false; - m_widget = 0; - m_layout = 0; - m_spacer = 0; -} - -DomLayoutItem::~DomLayoutItem() -{ - delete m_widget; - delete m_layout; - delete m_spacer; + m_widget = nullptr; + m_layout = nullptr; + m_spacer = nullptr; } void DomLayoutItem::read(QXmlStreamReader &reader) @@ -2565,10 +1787,6 @@ void DomLayoutItem::read(QXmlStreamReader &reader) break; case QXmlStreamReader::EndElement : return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; default : break; } @@ -2616,9 +1834,6 @@ void DomLayoutItem::write(QXmlStreamWriter &writer, const QString &tagName) cons default: break; } - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - writer.writeEndElement(); } @@ -2664,11 +1879,6 @@ void DomLayoutItem::setElementSpacer(DomSpacer *a) m_spacer = a; } -DomRow::DomRow() -{ - m_children = 0; -} - DomRow::~DomRow() { qDeleteAll(m_property); @@ -2692,10 +1902,6 @@ void DomRow::read(QXmlStreamReader &reader) break; case QXmlStreamReader::EndElement : return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; default : break; } @@ -2709,9 +1915,6 @@ void DomRow::write(QXmlStreamWriter &writer, const QString &tagName) const for (DomProperty *v : m_property) v->write(writer, QStringLiteral("property")); - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - writer.writeEndElement(); } @@ -2721,11 +1924,6 @@ void DomRow::setElementProperty(const QList &a) m_property = a; } -DomColumn::DomColumn() -{ - m_children = 0; -} - DomColumn::~DomColumn() { qDeleteAll(m_property); @@ -2749,10 +1947,6 @@ void DomColumn::read(QXmlStreamReader &reader) break; case QXmlStreamReader::EndElement : return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; default : break; } @@ -2766,9 +1960,6 @@ void DomColumn::write(QXmlStreamWriter &writer, const QString &tagName) const for (DomProperty *v : m_property) v->write(writer, QStringLiteral("property")); - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - writer.writeEndElement(); } @@ -2778,15 +1969,6 @@ void DomColumn::setElementProperty(const QList &a) m_property = a; } -DomItem::DomItem() -{ - m_children = 0; - m_has_attr_row = false; - m_attr_row = 0; - m_has_attr_column = false; - m_attr_column = 0; -} - DomItem::~DomItem() { qDeleteAll(m_property); @@ -2832,10 +2014,6 @@ void DomItem::read(QXmlStreamReader &reader) break; case QXmlStreamReader::EndElement : return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; default : break; } @@ -2858,9 +2036,6 @@ void DomItem::write(QXmlStreamWriter &writer, const QString &tagName) const for (DomItem *v : m_item) v->write(writer, QStringLiteral("item")); - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - writer.writeEndElement(); } @@ -2876,24 +2051,11 @@ void DomItem::setElementItem(const QVector &a) m_item = a; } -DomWidget::DomWidget() -{ - m_children = 0; - m_has_attr_class = false; - m_has_attr_name = false; - m_has_attr_native = false; - m_attr_native = false; -} - DomWidget::~DomWidget() { m_class.clear(); qDeleteAll(m_property); m_property.clear(); - qDeleteAll(m_script); - m_script.clear(); - qDeleteAll(m_widgetData); - m_widgetData.clear(); qDeleteAll(m_attribute); m_attribute.clear(); qDeleteAll(m_row); @@ -2949,18 +2111,6 @@ void DomWidget::read(QXmlStreamReader &reader) m_property.append(v); continue; } - if (!tag.compare(QLatin1String("script"), Qt::CaseInsensitive)) { - DomScript *v = new DomScript(); - v->read(reader); - m_script.append(v); - continue; - } - if (!tag.compare(QLatin1String("widgetdata"), Qt::CaseInsensitive)) { - DomWidgetData *v = new DomWidgetData(); - v->read(reader); - m_widgetData.append(v); - continue; - } if (!tag.compare(QLatin1String("attribute"), Qt::CaseInsensitive)) { DomProperty *v = new DomProperty(); v->read(reader); @@ -3024,10 +2174,6 @@ void DomWidget::read(QXmlStreamReader &reader) break; case QXmlStreamReader::EndElement : return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; default : break; } @@ -3053,12 +2199,6 @@ void DomWidget::write(QXmlStreamWriter &writer, const QString &tagName) const for (DomProperty *v : m_property) v->write(writer, QStringLiteral("property")); - for (DomScript *v : m_script) - v->write(writer, QStringLiteral("script")); - - for (DomWidgetData *v : m_widgetData) - v->write(writer, QStringLiteral("widgetdata")); - for (DomProperty *v : m_attribute) v->write(writer, QStringLiteral("attribute")); @@ -3089,9 +2229,6 @@ void DomWidget::write(QXmlStreamWriter &writer, const QString &tagName) const for (const QString &v : m_zOrder) writer.writeTextElement(QStringLiteral("zorder"), v); - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - writer.writeEndElement(); } @@ -3107,18 +2244,6 @@ void DomWidget::setElementProperty(const QList &a) m_property = a; } -void DomWidget::setElementScript(const QVector &a) -{ - m_children |= Script; - m_script = a; -} - -void DomWidget::setElementWidgetData(const QVector &a) -{ - m_children |= WidgetData; - m_widgetData = a; -} - void DomWidget::setElementAttribute(const QList &a) { m_children |= Attribute; @@ -3179,12 +2304,6 @@ void DomWidget::setElementZOrder(const QStringList &a) m_zOrder = a; } -DomSpacer::DomSpacer() -{ - m_children = 0; - m_has_attr_name = false; -} - DomSpacer::~DomSpacer() { qDeleteAll(m_property); @@ -3218,10 +2337,6 @@ void DomSpacer::read(QXmlStreamReader &reader) break; case QXmlStreamReader::EndElement : return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; default : break; } @@ -3238,9 +2353,6 @@ void DomSpacer::write(QXmlStreamWriter &writer, const QString &tagName) const for (DomProperty *v : m_property) v->write(writer, QStringLiteral("property")); - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - writer.writeEndElement(); } @@ -3250,16 +2362,6 @@ void DomSpacer::setElementProperty(const QList &a) m_property = a; } -DomColor::DomColor() -{ - m_children = 0; - m_has_attr_alpha = false; - m_attr_alpha = 0; - m_red = 0; - m_green = 0; - m_blue = 0; -} - DomColor::~DomColor() { } @@ -3297,10 +2399,6 @@ void DomColor::read(QXmlStreamReader &reader) break; case QXmlStreamReader::EndElement : return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; default : break; } @@ -3323,9 +2421,6 @@ void DomColor::write(QXmlStreamWriter &writer, const QString &tagName) const if (m_children & Blue) writer.writeTextElement(QStringLiteral("blue"), QString::number(m_blue)); - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - writer.writeEndElement(); } @@ -3362,14 +2457,6 @@ void DomColor::clearElementBlue() m_children &= ~Blue; } -DomGradientStop::DomGradientStop() -{ - m_children = 0; - m_has_attr_position = false; - m_attr_position = 0.0; - m_color = 0; -} - DomGradientStop::~DomGradientStop() { delete m_color; @@ -3402,10 +2489,6 @@ void DomGradientStop::read(QXmlStreamReader &reader) break; case QXmlStreamReader::EndElement : return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; default : break; } @@ -3422,9 +2505,6 @@ void DomGradientStop::write(QXmlStreamWriter &writer, const QString &tagName) co if (m_children & Color) m_color->write(writer, QStringLiteral("color")); - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - writer.writeEndElement(); } @@ -3450,34 +2530,6 @@ void DomGradientStop::clearElementColor() m_children &= ~Color; } -DomGradient::DomGradient() -{ - m_children = 0; - m_has_attr_startX = false; - m_attr_startX = 0.0; - m_has_attr_startY = false; - m_attr_startY = 0.0; - m_has_attr_endX = false; - m_attr_endX = 0.0; - m_has_attr_endY = false; - m_attr_endY = 0.0; - m_has_attr_centralX = false; - m_attr_centralX = 0.0; - m_has_attr_centralY = false; - m_attr_centralY = 0.0; - m_has_attr_focalX = false; - m_attr_focalX = 0.0; - m_has_attr_focalY = false; - m_attr_focalY = 0.0; - m_has_attr_radius = false; - m_attr_radius = 0.0; - m_has_attr_angle = false; - m_attr_angle = 0.0; - m_has_attr_type = false; - m_has_attr_spread = false; - m_has_attr_coordinateMode = false; -} - DomGradient::~DomGradient() { qDeleteAll(m_gradientStop); @@ -3559,10 +2611,6 @@ void DomGradient::read(QXmlStreamReader &reader) break; case QXmlStreamReader::EndElement : return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; default : break; } @@ -3615,9 +2663,6 @@ void DomGradient::write(QXmlStreamWriter &writer, const QString &tagName) const for (DomGradientStop *v : m_gradientStop) v->write(writer, QStringLiteral("gradientstop")); - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - writer.writeEndElement(); } @@ -3627,6 +2672,13 @@ void DomGradient::setElementGradientStop(const QVector &a) m_gradientStop = a; } +DomBrush::~DomBrush() +{ + delete m_color; + delete m_texture; + delete m_gradient; +} + void DomBrush::clear() { delete m_color; @@ -3635,26 +2687,9 @@ void DomBrush::clear() m_kind = Unknown; - m_color = 0; - m_texture = 0; - m_gradient = 0; -} - -DomBrush::DomBrush() -{ - m_kind = Unknown; - - m_has_attr_brushStyle = false; - m_color = 0; - m_texture = 0; - m_gradient = 0; -} - -DomBrush::~DomBrush() -{ - delete m_color; - delete m_texture; - delete m_gradient; + m_color = nullptr; + m_texture = nullptr; + m_gradient = nullptr; } void DomBrush::read(QXmlStreamReader &reader) @@ -3696,10 +2731,6 @@ void DomBrush::read(QXmlStreamReader &reader) break; case QXmlStreamReader::EndElement : return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; default : break; } @@ -3735,9 +2766,6 @@ void DomBrush::write(QXmlStreamWriter &writer, const QString &tagName) const default: break; } - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - writer.writeEndElement(); } @@ -3783,13 +2811,6 @@ void DomBrush::setElementGradient(DomGradient *a) m_gradient = a; } -DomColorRole::DomColorRole() -{ - m_children = 0; - m_has_attr_role = false; - m_brush = 0; -} - DomColorRole::~DomColorRole() { delete m_brush; @@ -3822,10 +2843,6 @@ void DomColorRole::read(QXmlStreamReader &reader) break; case QXmlStreamReader::EndElement : return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; default : break; } @@ -3842,9 +2859,6 @@ void DomColorRole::write(QXmlStreamWriter &writer, const QString &tagName) const if (m_children & Brush) m_brush->write(writer, QStringLiteral("brush")); - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - writer.writeEndElement(); } @@ -3870,11 +2884,6 @@ void DomColorRole::clearElementBrush() m_children &= ~Brush; } -DomColorGroup::DomColorGroup() -{ - m_children = 0; -} - DomColorGroup::~DomColorGroup() { qDeleteAll(m_colorRole); @@ -3906,10 +2915,6 @@ void DomColorGroup::read(QXmlStreamReader &reader) break; case QXmlStreamReader::EndElement : return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; default : break; } @@ -3926,9 +2931,6 @@ void DomColorGroup::write(QXmlStreamWriter &writer, const QString &tagName) cons for (DomColor *v : m_color) v->write(writer, QStringLiteral("color")); - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - writer.writeEndElement(); } @@ -3944,14 +2946,6 @@ void DomColorGroup::setElementColor(const QVector &a) m_color = a; } -DomPalette::DomPalette() -{ - m_children = 0; - m_active = 0; - m_inactive = 0; - m_disabled = 0; -} - DomPalette::~DomPalette() { delete m_active; @@ -3988,10 +2982,6 @@ void DomPalette::read(QXmlStreamReader &reader) break; case QXmlStreamReader::EndElement : return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; default : break; } @@ -4011,9 +3001,6 @@ void DomPalette::write(QXmlStreamWriter &writer, const QString &tagName) const if (m_children & Disabled) m_disabled->write(writer, QStringLiteral("disabled")); - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - writer.writeEndElement(); } @@ -4083,19 +3070,6 @@ void DomPalette::clearElementDisabled() m_children &= ~Disabled; } -DomFont::DomFont() -{ - m_children = 0; - m_pointSize = 0; - m_weight = 0; - m_italic = false; - m_bold = false; - m_underline = false; - m_strikeOut = false; - m_antialiasing = false; - m_kerning = false; -} - DomFont::~DomFont() { } @@ -4151,10 +3125,6 @@ void DomFont::read(QXmlStreamReader &reader) break; case QXmlStreamReader::EndElement : return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; default : break; } @@ -4195,9 +3165,6 @@ void DomFont::write(QXmlStreamWriter &writer, const QString &tagName) const if (m_children & Kerning) writer.writeTextElement(QStringLiteral("kerning"), (m_kerning ? QLatin1String("true") : QLatin1String("false"))); - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - writer.writeEndElement(); } @@ -4311,13 +3278,6 @@ void DomFont::clearElementKerning() m_children &= ~Kerning; } -DomPoint::DomPoint() -{ - m_children = 0; - m_x = 0; - m_y = 0; -} - DomPoint::~DomPoint() { } @@ -4341,10 +3301,6 @@ void DomPoint::read(QXmlStreamReader &reader) break; case QXmlStreamReader::EndElement : return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; default : break; } @@ -4361,9 +3317,6 @@ void DomPoint::write(QXmlStreamWriter &writer, const QString &tagName) const if (m_children & Y) writer.writeTextElement(QString(QLatin1Char('y')), QString::number(m_y)); - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - writer.writeEndElement(); } @@ -4389,15 +3342,6 @@ void DomPoint::clearElementY() m_children &= ~Y; } -DomRect::DomRect() -{ - m_children = 0; - m_x = 0; - m_y = 0; - m_width = 0; - m_height = 0; -} - DomRect::~DomRect() { } @@ -4429,10 +3373,6 @@ void DomRect::read(QXmlStreamReader &reader) break; case QXmlStreamReader::EndElement : return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; default : break; } @@ -4455,9 +3395,6 @@ void DomRect::write(QXmlStreamWriter &writer, const QString &tagName) const if (m_children & Height) writer.writeTextElement(QStringLiteral("height"), QString::number(m_height)); - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - writer.writeEndElement(); } @@ -4505,12 +3442,6 @@ void DomRect::clearElementHeight() m_children &= ~Height; } -DomLocale::DomLocale() -{ - m_has_attr_language = false; - m_has_attr_country = false; -} - DomLocale::~DomLocale() { } @@ -4540,10 +3471,6 @@ void DomLocale::read(QXmlStreamReader &reader) break; case QXmlStreamReader::EndElement : return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; default : break; } @@ -4560,23 +3487,9 @@ void DomLocale::write(QXmlStreamWriter &writer, const QString &tagName) const if (hasAttributeCountry()) writer.writeAttribute(QStringLiteral("country"), attributeCountry()); - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - writer.writeEndElement(); } -DomSizePolicy::DomSizePolicy() -{ - m_children = 0; - m_has_attr_hSizeType = false; - m_has_attr_vSizeType = false; - m_hSizeType = 0; - m_vSizeType = 0; - m_horStretch = 0; - m_verStretch = 0; -} - DomSizePolicy::~DomSizePolicy() { } @@ -4622,10 +3535,6 @@ void DomSizePolicy::read(QXmlStreamReader &reader) break; case QXmlStreamReader::EndElement : return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; default : break; } @@ -4654,9 +3563,6 @@ void DomSizePolicy::write(QXmlStreamWriter &writer, const QString &tagName) cons if (m_children & VerStretch) writer.writeTextElement(QStringLiteral("verstretch"), QString::number(m_verStretch)); - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - writer.writeEndElement(); } @@ -4704,13 +3610,6 @@ void DomSizePolicy::clearElementVerStretch() m_children &= ~VerStretch; } -DomSize::DomSize() -{ - m_children = 0; - m_width = 0; - m_height = 0; -} - DomSize::~DomSize() { } @@ -4734,10 +3633,6 @@ void DomSize::read(QXmlStreamReader &reader) break; case QXmlStreamReader::EndElement : return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; default : break; } @@ -4754,9 +3649,6 @@ void DomSize::write(QXmlStreamWriter &writer, const QString &tagName) const if (m_children & Height) writer.writeTextElement(QStringLiteral("height"), QString::number(m_height)); - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - writer.writeEndElement(); } @@ -4782,14 +3674,6 @@ void DomSize::clearElementHeight() m_children &= ~Height; } -DomDate::DomDate() -{ - m_children = 0; - m_year = 0; - m_month = 0; - m_day = 0; -} - DomDate::~DomDate() { } @@ -4817,10 +3701,6 @@ void DomDate::read(QXmlStreamReader &reader) break; case QXmlStreamReader::EndElement : return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; default : break; } @@ -4840,9 +3720,6 @@ void DomDate::write(QXmlStreamWriter &writer, const QString &tagName) const if (m_children & Day) writer.writeTextElement(QStringLiteral("day"), QString::number(m_day)); - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - writer.writeEndElement(); } @@ -4879,14 +3756,6 @@ void DomDate::clearElementDay() m_children &= ~Day; } -DomTime::DomTime() -{ - m_children = 0; - m_hour = 0; - m_minute = 0; - m_second = 0; -} - DomTime::~DomTime() { } @@ -4914,10 +3783,6 @@ void DomTime::read(QXmlStreamReader &reader) break; case QXmlStreamReader::EndElement : return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; default : break; } @@ -4937,9 +3802,6 @@ void DomTime::write(QXmlStreamWriter &writer, const QString &tagName) const if (m_children & Second) writer.writeTextElement(QStringLiteral("second"), QString::number(m_second)); - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - writer.writeEndElement(); } @@ -4976,17 +3838,6 @@ void DomTime::clearElementSecond() m_children &= ~Second; } -DomDateTime::DomDateTime() -{ - m_children = 0; - m_hour = 0; - m_minute = 0; - m_second = 0; - m_year = 0; - m_month = 0; - m_day = 0; -} - DomDateTime::~DomDateTime() { } @@ -5026,10 +3877,6 @@ void DomDateTime::read(QXmlStreamReader &reader) break; case QXmlStreamReader::EndElement : return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; default : break; } @@ -5058,9 +3905,6 @@ void DomDateTime::write(QXmlStreamWriter &writer, const QString &tagName) const if (m_children & Day) writer.writeTextElement(QStringLiteral("day"), QString::number(m_day)); - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - writer.writeEndElement(); } @@ -5130,14 +3974,6 @@ void DomDateTime::clearElementDay() m_children &= ~Day; } -DomStringList::DomStringList() -{ - m_children = 0; - m_has_attr_notr = false; - m_has_attr_comment = false; - m_has_attr_extraComment = false; -} - DomStringList::~DomStringList() { m_string.clear(); @@ -5176,10 +4012,6 @@ void DomStringList::read(QXmlStreamReader &reader) break; case QXmlStreamReader::EndElement : return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; default : break; } @@ -5202,9 +4034,6 @@ void DomStringList::write(QXmlStreamWriter &writer, const QString &tagName) cons for (const QString &v : m_string) writer.writeTextElement(QStringLiteral("string"), v); - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - writer.writeEndElement(); } @@ -5214,13 +4043,6 @@ void DomStringList::setElementString(const QStringList &a) m_string = a; } -DomResourcePixmap::DomResourcePixmap() -{ - m_has_attr_resource = false; - m_has_attr_alias = false; - m_text.clear(); -} - DomResourcePixmap::~DomResourcePixmap() { } @@ -5276,22 +4098,6 @@ void DomResourcePixmap::write(QXmlStreamWriter &writer, const QString &tagName) writer.writeEndElement(); } -DomResourceIcon::DomResourceIcon() -{ - m_children = 0; - m_has_attr_theme = false; - m_has_attr_resource = false; - m_text.clear(); - m_normalOff = 0; - m_normalOn = 0; - m_disabledOff = 0; - m_disabledOn = 0; - m_activeOff = 0; - m_activeOn = 0; - m_selectedOff = 0; - m_selectedOn = 0; -} - DomResourceIcon::~DomResourceIcon() { delete m_normalOff; @@ -5603,14 +4409,6 @@ void DomResourceIcon::clearElementSelectedOn() m_children &= ~SelectedOn; } -DomString::DomString() -{ - m_has_attr_notr = false; - m_has_attr_comment = false; - m_has_attr_extraComment = false; - m_text.clear(); -} - DomString::~DomString() { } @@ -5673,13 +4471,6 @@ void DomString::write(QXmlStreamWriter &writer, const QString &tagName) const writer.writeEndElement(); } -DomPointF::DomPointF() -{ - m_children = 0; - m_x = 0; - m_y = 0; -} - DomPointF::~DomPointF() { } @@ -5703,10 +4494,6 @@ void DomPointF::read(QXmlStreamReader &reader) break; case QXmlStreamReader::EndElement : return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; default : break; } @@ -5723,9 +4510,6 @@ void DomPointF::write(QXmlStreamWriter &writer, const QString &tagName) const if (m_children & Y) writer.writeTextElement(QString(QLatin1Char('y')), QString::number(m_y, 'f', 15)); - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - writer.writeEndElement(); } @@ -5751,15 +4535,6 @@ void DomPointF::clearElementY() m_children &= ~Y; } -DomRectF::DomRectF() -{ - m_children = 0; - m_x = 0; - m_y = 0; - m_width = 0; - m_height = 0; -} - DomRectF::~DomRectF() { } @@ -5791,10 +4566,6 @@ void DomRectF::read(QXmlStreamReader &reader) break; case QXmlStreamReader::EndElement : return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; default : break; } @@ -5817,9 +4588,6 @@ void DomRectF::write(QXmlStreamWriter &writer, const QString &tagName) const if (m_children & Height) writer.writeTextElement(QStringLiteral("height"), QString::number(m_height, 'f', 15)); - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - writer.writeEndElement(); } @@ -5867,13 +4635,6 @@ void DomRectF::clearElementHeight() m_children &= ~Height; } -DomSizeF::DomSizeF() -{ - m_children = 0; - m_width = 0; - m_height = 0; -} - DomSizeF::~DomSizeF() { } @@ -5897,10 +4658,6 @@ void DomSizeF::read(QXmlStreamReader &reader) break; case QXmlStreamReader::EndElement : return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; default : break; } @@ -5917,9 +4674,6 @@ void DomSizeF::write(QXmlStreamWriter &writer, const QString &tagName) const if (m_children & Height) writer.writeTextElement(QStringLiteral("height"), QString::number(m_height, 'f', 15)); - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - writer.writeEndElement(); } @@ -5945,12 +4699,6 @@ void DomSizeF::clearElementHeight() m_children &= ~Height; } -DomChar::DomChar() -{ - m_children = 0; - m_unicode = 0; -} - DomChar::~DomChar() { } @@ -5970,10 +4718,6 @@ void DomChar::read(QXmlStreamReader &reader) break; case QXmlStreamReader::EndElement : return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; default : break; } @@ -5987,9 +4731,6 @@ void DomChar::write(QXmlStreamWriter &writer, const QString &tagName) const if (m_children & Unicode) writer.writeTextElement(QStringLiteral("unicode"), QString::number(m_unicode)); - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - writer.writeEndElement(); } @@ -6004,12 +4745,6 @@ void DomChar::clearElementUnicode() m_children &= ~Unicode; } -DomUrl::DomUrl() -{ - m_children = 0; - m_string = 0; -} - DomUrl::~DomUrl() { delete m_string; @@ -6032,10 +4767,6 @@ void DomUrl::read(QXmlStreamReader &reader) break; case QXmlStreamReader::EndElement : return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; default : break; } @@ -6049,9 +4780,6 @@ void DomUrl::write(QXmlStreamWriter &writer, const QString &tagName) const if (m_children & String) m_string->write(writer, QStringLiteral("string")); - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - writer.writeEndElement(); } @@ -6077,6 +4805,31 @@ void DomUrl::clearElementString() m_children &= ~String; } +DomProperty::~DomProperty() +{ + delete m_color; + delete m_font; + delete m_iconSet; + delete m_pixmap; + delete m_palette; + delete m_point; + delete m_rect; + delete m_locale; + delete m_sizePolicy; + delete m_size; + delete m_string; + delete m_stringList; + delete m_date; + delete m_time; + delete m_dateTime; + delete m_pointF; + delete m_rectF; + delete m_sizeF; + delete m_char; + delete m_url; + delete m_brush; +} + void DomProperty::clear() { delete m_color; @@ -6103,96 +4856,34 @@ void DomProperty::clear() m_kind = Unknown; - m_color = 0; + m_color = nullptr; m_cursor = 0; - m_font = 0; - m_iconSet = 0; - m_pixmap = 0; - m_palette = 0; - m_point = 0; - m_rect = 0; - m_locale = 0; - m_sizePolicy = 0; - m_size = 0; - m_string = 0; - m_stringList = 0; + m_font = nullptr; + m_iconSet = nullptr; + m_pixmap = nullptr; + m_palette = nullptr; + m_point = nullptr; + m_rect = nullptr; + m_locale = nullptr; + m_sizePolicy = nullptr; + m_size = nullptr; + m_string = nullptr; + m_stringList = nullptr; m_number = 0; m_float = 0.0; - m_double = 0; - m_date = 0; - m_time = 0; - m_dateTime = 0; - m_pointF = 0; - m_rectF = 0; - m_sizeF = 0; + m_double = 0.0; + m_date = nullptr; + m_time = nullptr; + m_dateTime = nullptr; + m_pointF = nullptr; + m_rectF = nullptr; + m_sizeF = nullptr; m_longLong = 0; - m_char = 0; - m_url = 0; + m_char = nullptr; + m_url = nullptr; m_UInt = 0; m_uLongLong = 0; - m_brush = 0; -} - -DomProperty::DomProperty() -{ - m_kind = Unknown; - - m_has_attr_name = false; - m_has_attr_stdset = false; - m_attr_stdset = 0; - m_color = 0; - m_cursor = 0; - m_font = 0; - m_iconSet = 0; - m_pixmap = 0; - m_palette = 0; - m_point = 0; - m_rect = 0; - m_locale = 0; - m_sizePolicy = 0; - m_size = 0; - m_string = 0; - m_stringList = 0; - m_number = 0; - m_float = 0.0; - m_double = 0; - m_date = 0; - m_time = 0; - m_dateTime = 0; - m_pointF = 0; - m_rectF = 0; - m_sizeF = 0; - m_longLong = 0; - m_char = 0; - m_url = 0; - m_UInt = 0; - m_uLongLong = 0; - m_brush = 0; -} - -DomProperty::~DomProperty() -{ - delete m_color; - delete m_font; - delete m_iconSet; - delete m_pixmap; - delete m_palette; - delete m_point; - delete m_rect; - delete m_locale; - delete m_sizePolicy; - delete m_size; - delete m_string; - delete m_stringList; - delete m_date; - delete m_time; - delete m_dateTime; - delete m_pointF; - delete m_rectF; - delete m_sizeF; - delete m_char; - delete m_url; - delete m_brush; + m_brush = nullptr; } void DomProperty::read(QXmlStreamReader &reader) @@ -6394,10 +5085,6 @@ void DomProperty::read(QXmlStreamReader &reader) break; case QXmlStreamReader::EndElement : return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; default : break; } @@ -6592,9 +5279,6 @@ void DomProperty::write(QXmlStreamWriter &writer, const QString &tagName) const default: break; } - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - writer.writeEndElement(); } @@ -6976,11 +5660,6 @@ void DomProperty::setElementBrush(DomBrush *a) m_brush = a; } -DomConnections::DomConnections() -{ - m_children = 0; -} - DomConnections::~DomConnections() { qDeleteAll(m_connection); @@ -7004,10 +5683,6 @@ void DomConnections::read(QXmlStreamReader &reader) break; case QXmlStreamReader::EndElement : return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; default : break; } @@ -7021,9 +5696,6 @@ void DomConnections::write(QXmlStreamWriter &writer, const QString &tagName) con for (DomConnection *v : m_connection) v->write(writer, QStringLiteral("connection")); - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - writer.writeEndElement(); } @@ -7033,12 +5705,6 @@ void DomConnections::setElementConnection(const QVector &a) m_connection = a; } -DomConnection::DomConnection() -{ - m_children = 0; - m_hints = 0; -} - DomConnection::~DomConnection() { delete m_hints; @@ -7077,10 +5743,6 @@ void DomConnection::read(QXmlStreamReader &reader) break; case QXmlStreamReader::EndElement : return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; default : break; } @@ -7106,9 +5768,6 @@ void DomConnection::write(QXmlStreamWriter &writer, const QString &tagName) cons if (m_children & Hints) m_hints->write(writer, QStringLiteral("hints")); - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - writer.writeEndElement(); } @@ -7178,11 +5837,6 @@ void DomConnection::clearElementHints() m_children &= ~Hints; } -DomConnectionHints::DomConnectionHints() -{ - m_children = 0; -} - DomConnectionHints::~DomConnectionHints() { qDeleteAll(m_hint); @@ -7206,10 +5860,6 @@ void DomConnectionHints::read(QXmlStreamReader &reader) break; case QXmlStreamReader::EndElement : return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; default : break; } @@ -7223,9 +5873,6 @@ void DomConnectionHints::write(QXmlStreamWriter &writer, const QString &tagName) for (DomConnectionHint *v : m_hint) v->write(writer, QStringLiteral("hint")); - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - writer.writeEndElement(); } @@ -7235,14 +5882,6 @@ void DomConnectionHints::setElementHint(const QVector &a) m_hint = a; } -DomConnectionHint::DomConnectionHint() -{ - m_children = 0; - m_has_attr_type = false; - m_x = 0; - m_y = 0; -} - DomConnectionHint::~DomConnectionHint() { } @@ -7276,10 +5915,6 @@ void DomConnectionHint::read(QXmlStreamReader &reader) break; case QXmlStreamReader::EndElement : return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; default : break; } @@ -7299,9 +5934,6 @@ void DomConnectionHint::write(QXmlStreamWriter &writer, const QString &tagName) if (m_children & Y) writer.writeTextElement(QString(QLatin1Char('y')), QString::number(m_y)); - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - writer.writeEndElement(); } @@ -7327,129 +5959,6 @@ void DomConnectionHint::clearElementY() m_children &= ~Y; } -DomScript::DomScript() -{ - m_has_attr_source = false; - m_has_attr_language = false; -} - -DomScript::~DomScript() -{ -} - -void DomScript::read(QXmlStreamReader &reader) -{ - const QXmlStreamAttributes &attributes = reader.attributes(); - for (const QXmlStreamAttribute &attribute : attributes) { - const QStringRef name = attribute.name(); - if (name == QLatin1String("source")) { - setAttributeSource(attribute.value().toString()); - continue; - } - if (name == QLatin1String("language")) { - setAttributeLanguage(attribute.value().toString()); - continue; - } - reader.raiseError(QLatin1String("Unexpected attribute ") + name); - } - - while (!reader.hasError()) { - switch (reader.readNext()) { - case QXmlStreamReader::StartElement : { - const QStringRef 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 DomScript::write(QXmlStreamWriter &writer, const QString &tagName) const -{ - writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("script") : tagName.toLower()); - - if (hasAttributeSource()) - writer.writeAttribute(QStringLiteral("source"), attributeSource()); - - if (hasAttributeLanguage()) - writer.writeAttribute(QStringLiteral("language"), attributeLanguage()); - - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - - writer.writeEndElement(); -} - -DomWidgetData::DomWidgetData() -{ - m_children = 0; -} - -DomWidgetData::~DomWidgetData() -{ - qDeleteAll(m_property); - m_property.clear(); -} - -void DomWidgetData::read(QXmlStreamReader &reader) -{ - while (!reader.hasError()) { - switch (reader.readNext()) { - case QXmlStreamReader::StartElement : { - const QStringRef tag = reader.name(); - if (!tag.compare(QLatin1String("property"), Qt::CaseInsensitive)) { - DomProperty *v = new DomProperty(); - v->read(reader); - m_property.append(v); - continue; - } - 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 DomWidgetData::write(QXmlStreamWriter &writer, const QString &tagName) const -{ - writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("widgetdata") : tagName.toLower()); - - for (DomProperty *v : m_property) - v->write(writer, QStringLiteral("property")); - - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - - writer.writeEndElement(); -} - -void DomWidgetData::setElementProperty(const QList &a) -{ - m_children |= Property; - m_property = a; -} - -DomDesignerData::DomDesignerData() -{ - m_children = 0; -} - DomDesignerData::~DomDesignerData() { qDeleteAll(m_property); @@ -7473,10 +5982,6 @@ void DomDesignerData::read(QXmlStreamReader &reader) break; case QXmlStreamReader::EndElement : return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; default : break; } @@ -7490,9 +5995,6 @@ void DomDesignerData::write(QXmlStreamWriter &writer, const QString &tagName) co for (DomProperty *v : m_property) v->write(writer, QStringLiteral("property")); - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - writer.writeEndElement(); } @@ -7502,11 +6004,6 @@ void DomDesignerData::setElementProperty(const QList &a) m_property = a; } -DomSlots::DomSlots() -{ - m_children = 0; -} - DomSlots::~DomSlots() { m_signal.clear(); @@ -7532,10 +6029,6 @@ void DomSlots::read(QXmlStreamReader &reader) break; case QXmlStreamReader::EndElement : return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; default : break; } @@ -7552,9 +6045,6 @@ void DomSlots::write(QXmlStreamWriter &writer, const QString &tagName) const for (const QString &v : m_slot) writer.writeTextElement(QStringLiteral("slot"), v); - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - writer.writeEndElement(); } @@ -7570,11 +6060,6 @@ void DomSlots::setElementSlot(const QStringList &a) m_slot = a; } -DomPropertySpecifications::DomPropertySpecifications() -{ - m_children = 0; -} - DomPropertySpecifications::~DomPropertySpecifications() { qDeleteAll(m_tooltip); @@ -7606,10 +6091,6 @@ void DomPropertySpecifications::read(QXmlStreamReader &reader) break; case QXmlStreamReader::EndElement : return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; default : break; } @@ -7626,9 +6107,6 @@ void DomPropertySpecifications::write(QXmlStreamWriter &writer, const QString &t for (DomStringPropertySpecification *v : m_stringpropertyspecification) v->write(writer, QStringLiteral("stringpropertyspecification")); - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - writer.writeEndElement(); } @@ -7644,11 +6122,6 @@ void DomPropertySpecifications::setElementStringpropertyspecification(const QVec m_stringpropertyspecification = a; } -DomPropertyToolTip::DomPropertyToolTip() -{ - m_has_attr_name = false; -} - DomPropertyToolTip::~DomPropertyToolTip() { } @@ -7674,10 +6147,6 @@ void DomPropertyToolTip::read(QXmlStreamReader &reader) break; case QXmlStreamReader::EndElement : return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; default : break; } @@ -7691,19 +6160,9 @@ void DomPropertyToolTip::write(QXmlStreamWriter &writer, const QString &tagName) if (hasAttributeName()) writer.writeAttribute(QStringLiteral("name"), attributeName()); - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - writer.writeEndElement(); } -DomStringPropertySpecification::DomStringPropertySpecification() -{ - m_has_attr_name = false; - m_has_attr_type = false; - m_has_attr_notr = false; -} - DomStringPropertySpecification::~DomStringPropertySpecification() { } @@ -7737,10 +6196,6 @@ void DomStringPropertySpecification::read(QXmlStreamReader &reader) break; case QXmlStreamReader::EndElement : return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; default : break; } @@ -7760,9 +6215,6 @@ void DomStringPropertySpecification::write(QXmlStreamWriter &writer, const QStri if (hasAttributeNotr()) writer.writeAttribute(QStringLiteral("notr"), attributeNotr()); - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - writer.writeEndElement(); } diff --git a/src/tools/uic/ui4.h b/src/tools/uic/ui4.h index 6b2de2decd..08a5ed01d5 100644 --- a/src/tools/uic/ui4.h +++ b/src/tools/uic/ui4.h @@ -86,15 +86,9 @@ class DomAction; class DomActionRef; class DomButtonGroup; class DomButtonGroups; -class DomImages; -class DomImage; -class DomImageData; class DomCustomWidgets; class DomHeader; class DomCustomWidget; -class DomProperties; -class DomPropertyData; -class DomSizePolicyData; class DomLayoutDefault; class DomLayoutFunction; class DomTabStops; @@ -135,8 +129,6 @@ class DomConnections; class DomConnection; class DomConnectionHints; class DomConnectionHint; -class DomScript; -class DomWidgetData; class DomDesignerData; class DomSlots; class DomPropertySpecifications; @@ -150,13 +142,11 @@ class DomStringPropertySpecification; class QDESIGNER_UILIB_EXPORT DomUI { Q_DISABLE_COPY(DomUI) public: - DomUI(); + DomUI() = default; ~DomUI(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } // attribute accessors inline bool hasAttributeVersion() const { return m_has_attr_version; } @@ -240,12 +230,6 @@ public: inline bool hasElementTabStops() const { return m_children & TabStops; } void clearElementTabStops(); - inline DomImages *elementImages() const { return m_images; } - DomImages *takeElementImages(); - void setElementImages(DomImages *a); - inline bool hasElementImages() const { return m_children & Images; } - void clearElementImages(); - inline DomIncludes *elementIncludes() const { return m_includes; } DomIncludes *takeElementIncludes(); void setElementIncludes(DomIncludes *a); @@ -283,43 +267,41 @@ public: void clearElementButtonGroups(); private: - QString m_text; - // attribute data QString m_attr_version; - bool m_has_attr_version; + bool m_has_attr_version = false; QString m_attr_language; - bool m_has_attr_language; + bool m_has_attr_language = false; QString m_attr_displayname; - bool m_has_attr_displayname; + bool m_has_attr_displayname = false; - int m_attr_stdsetdef; - bool m_has_attr_stdsetdef; + int m_attr_stdsetdef = 0; + bool m_has_attr_stdsetdef = false; - int m_attr_stdSetDef; - bool m_has_attr_stdSetDef; + int m_attr_stdSetDef = 0; + bool m_has_attr_stdSetDef = false; // child element data - uint m_children; + uint m_children = 0; QString m_author; QString m_comment; QString m_exportMacro; QString m_class; - DomWidget *m_widget; - DomLayoutDefault *m_layoutDefault; - DomLayoutFunction *m_layoutFunction; + DomWidget *m_widget = nullptr; + DomLayoutDefault *m_layoutDefault = nullptr; + DomLayoutFunction *m_layoutFunction = nullptr; QString m_pixmapFunction; - DomCustomWidgets *m_customWidgets; - DomTabStops *m_tabStops; - DomImages *m_images; - DomIncludes *m_includes; - DomResources *m_resources; - DomConnections *m_connections; - DomDesignerData *m_designerdata; - DomSlots *m_slots; - DomButtonGroups *m_buttonGroups; + DomCustomWidgets *m_customWidgets = nullptr; + DomTabStops *m_tabStops = nullptr; + DomIncludes *m_includes = nullptr; + DomResources *m_resources = nullptr; + DomConnections *m_connections = nullptr; + DomDesignerData *m_designerdata = nullptr; + DomSlots *m_slots = nullptr; + DomButtonGroups *m_buttonGroups = nullptr; + enum Child { Author = 1, Comment = 2, @@ -331,37 +313,34 @@ private: PixmapFunction = 128, CustomWidgets = 256, TabStops = 512, - Images = 1024, - Includes = 2048, - Resources = 4096, - Connections = 8192, - Designerdata = 16384, - Slots = 32768, - ButtonGroups = 65536 + Includes = 1024, + Resources = 2048, + Connections = 4096, + Designerdata = 8192, + Slots = 16384, + ButtonGroups = 32768 }; }; class QDESIGNER_UILIB_EXPORT DomIncludes { Q_DISABLE_COPY(DomIncludes) public: - DomIncludes(); + DomIncludes() = default; ~DomIncludes(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } // child element accessors inline QVector elementInclude() const { return m_include; } void setElementInclude(const QVector &a); private: - QString m_text; // child element data - uint m_children; + uint m_children = 0; QVector m_include; + enum Child { Include = 1 }; @@ -370,11 +349,12 @@ private: class QDESIGNER_UILIB_EXPORT DomInclude { Q_DISABLE_COPY(DomInclude) public: - DomInclude(); + DomInclude() = default; ~DomInclude(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; + inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -394,23 +374,20 @@ private: // attribute data QString m_attr_location; - bool m_has_attr_location; + bool m_has_attr_location = false; QString m_attr_impldecl; - bool m_has_attr_impldecl; - + bool m_has_attr_impldecl = false; }; class QDESIGNER_UILIB_EXPORT DomResources { Q_DISABLE_COPY(DomResources) public: - DomResources(); + DomResources() = default; ~DomResources(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } // attribute accessors inline bool hasAttributeName() const { return m_has_attr_name; } @@ -423,15 +400,14 @@ public: void setElementInclude(const QVector &a); private: - QString m_text; - // attribute data QString m_attr_name; - bool m_has_attr_name; + bool m_has_attr_name = false; // child element data - uint m_children; + uint m_children = 0; QVector m_include; + enum Child { Include = 1 }; @@ -440,13 +416,11 @@ private: class QDESIGNER_UILIB_EXPORT DomResource { Q_DISABLE_COPY(DomResource) public: - DomResource(); + DomResource() = default; ~DomResource(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } // attribute accessors inline bool hasAttributeLocation() const { return m_has_attr_location; } @@ -455,24 +429,19 @@ public: inline void clearAttributeLocation() { m_has_attr_location = false; } private: - QString m_text; - // attribute data QString m_attr_location; - bool m_has_attr_location; - + bool m_has_attr_location = false; }; class QDESIGNER_UILIB_EXPORT DomActionGroup { Q_DISABLE_COPY(DomActionGroup) public: - DomActionGroup(); + DomActionGroup() = default; ~DomActionGroup(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } // attribute accessors inline bool hasAttributeName() const { return m_has_attr_name; } @@ -494,18 +463,17 @@ public: void setElementAttribute(const QList &a); private: - QString m_text; - // attribute data QString m_attr_name; - bool m_has_attr_name; + bool m_has_attr_name = false; // child element data - uint m_children; + uint m_children = 0; QVector m_action; QVector m_actionGroup; QList m_property; QList m_attribute; + enum Child { Action = 1, ActionGroup = 2, @@ -517,13 +485,11 @@ private: class QDESIGNER_UILIB_EXPORT DomAction { Q_DISABLE_COPY(DomAction) public: - DomAction(); + DomAction() = default; ~DomAction(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } // attribute accessors inline bool hasAttributeName() const { return m_has_attr_name; } @@ -544,19 +510,18 @@ public: void setElementAttribute(const QList &a); private: - QString m_text; - // attribute data QString m_attr_name; - bool m_has_attr_name; + bool m_has_attr_name = false; QString m_attr_menu; - bool m_has_attr_menu; + bool m_has_attr_menu = false; // child element data - uint m_children; + uint m_children = 0; QList m_property; QList m_attribute; + enum Child { Property = 1, Attribute = 2 @@ -566,13 +531,11 @@ private: class QDESIGNER_UILIB_EXPORT DomActionRef { Q_DISABLE_COPY(DomActionRef) public: - DomActionRef(); + DomActionRef() = default; ~DomActionRef(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } // attribute accessors inline bool hasAttributeName() const { return m_has_attr_name; } @@ -581,24 +544,19 @@ public: inline void clearAttributeName() { m_has_attr_name = false; } private: - QString m_text; - // attribute data QString m_attr_name; - bool m_has_attr_name; - + bool m_has_attr_name = false; }; class QDESIGNER_UILIB_EXPORT DomButtonGroup { Q_DISABLE_COPY(DomButtonGroup) public: - DomButtonGroup(); + DomButtonGroup() = default; ~DomButtonGroup(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } // attribute accessors inline bool hasAttributeName() const { return m_has_attr_name; } @@ -614,16 +572,15 @@ public: void setElementAttribute(const QList &a); private: - QString m_text; - // attribute data QString m_attr_name; - bool m_has_attr_name; + bool m_has_attr_name = false; // child element data - uint m_children; + uint m_children = 0; QList m_property; QList m_attribute; + enum Child { Property = 1, Attribute = 2 @@ -633,149 +590,46 @@ private: class QDESIGNER_UILIB_EXPORT DomButtonGroups { Q_DISABLE_COPY(DomButtonGroups) public: - DomButtonGroups(); + DomButtonGroups() = default; ~DomButtonGroups(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } // child element accessors inline QVector elementButtonGroup() const { return m_buttonGroup; } void setElementButtonGroup(const QVector &a); private: - QString m_text; // child element data - uint m_children; + uint m_children = 0; QVector m_buttonGroup; + enum Child { ButtonGroup = 1 }; }; -class QDESIGNER_UILIB_EXPORT DomImages { - Q_DISABLE_COPY(DomImages) -public: - DomImages(); - ~DomImages(); - - void read(QXmlStreamReader &reader); - void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } - - // child element accessors - inline QVector elementImage() const { return m_image; } - void setElementImage(const QVector &a); - -private: - QString m_text; - - // child element data - uint m_children; - QVector m_image; - enum Child { - Image = 1 - }; -}; - -class QDESIGNER_UILIB_EXPORT DomImage { - Q_DISABLE_COPY(DomImage) -public: - DomImage(); - ~DomImage(); - - void read(QXmlStreamReader &reader); - void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } - - // attribute accessors - inline bool hasAttributeName() const { return m_has_attr_name; } - inline QString attributeName() const { return m_attr_name; } - inline void setAttributeName(const QString &a) { m_attr_name = a; m_has_attr_name = true; } - inline void clearAttributeName() { m_has_attr_name = false; } - - // child element accessors - inline DomImageData *elementData() const { return m_data; } - DomImageData *takeElementData(); - void setElementData(DomImageData *a); - inline bool hasElementData() const { return m_children & Data; } - void clearElementData(); - -private: - QString m_text; - - // attribute data - QString m_attr_name; - bool m_has_attr_name; - - // child element data - uint m_children; - DomImageData *m_data; - enum Child { - Data = 1 - }; -}; - -class QDESIGNER_UILIB_EXPORT DomImageData { - Q_DISABLE_COPY(DomImageData) -public: - DomImageData(); - ~DomImageData(); - - void read(QXmlStreamReader &reader); - void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } - - // attribute accessors - inline bool hasAttributeFormat() const { return m_has_attr_format; } - inline QString attributeFormat() const { return m_attr_format; } - inline void setAttributeFormat(const QString &a) { m_attr_format = a; m_has_attr_format = true; } - inline void clearAttributeFormat() { m_has_attr_format = false; } - - inline bool hasAttributeLength() const { return m_has_attr_length; } - inline int attributeLength() const { return m_attr_length; } - inline void setAttributeLength(int a) { m_attr_length = a; m_has_attr_length = true; } - inline void clearAttributeLength() { m_has_attr_length = false; } - -private: - QString m_text; - - // attribute data - QString m_attr_format; - bool m_has_attr_format; - - int m_attr_length; - bool m_has_attr_length; - -}; - class QDESIGNER_UILIB_EXPORT DomCustomWidgets { Q_DISABLE_COPY(DomCustomWidgets) public: - DomCustomWidgets(); + DomCustomWidgets() = default; ~DomCustomWidgets(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } // child element accessors inline QVector elementCustomWidget() const { return m_customWidget; } void setElementCustomWidget(const QVector &a); private: - QString m_text; // child element data - uint m_children; + uint m_children = 0; QVector m_customWidget; + enum Child { CustomWidget = 1 }; @@ -784,11 +638,12 @@ private: class QDESIGNER_UILIB_EXPORT DomHeader { Q_DISABLE_COPY(DomHeader) public: - DomHeader(); + DomHeader() = default; ~DomHeader(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; + inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -803,20 +658,17 @@ private: // attribute data QString m_attr_location; - bool m_has_attr_location; - + bool m_has_attr_location = false; }; class QDESIGNER_UILIB_EXPORT DomCustomWidget { Q_DISABLE_COPY(DomCustomWidget) public: - DomCustomWidget(); + DomCustomWidget() = default; ~DomCustomWidget(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } // child element accessors inline QString elementClass() const { return m_class; } @@ -851,29 +703,11 @@ public: inline bool hasElementContainer() const { return m_children & Container; } void clearElementContainer(); - inline DomSizePolicyData *elementSizePolicy() const { return m_sizePolicy; } - DomSizePolicyData *takeElementSizePolicy(); - void setElementSizePolicy(DomSizePolicyData *a); - inline bool hasElementSizePolicy() const { return m_children & SizePolicy; } - void clearElementSizePolicy(); - inline QString elementPixmap() const { return m_pixmap; } void setElementPixmap(const QString &a); inline bool hasElementPixmap() const { return m_children & Pixmap; } void clearElementPixmap(); - inline DomScript *elementScript() const { return m_script; } - DomScript *takeElementScript(); - void setElementScript(DomScript *a); - inline bool hasElementScript() const { return m_children & Script; } - void clearElementScript(); - - inline DomProperties *elementProperties() const { return m_properties; } - DomProperties *takeElementProperties(); - void setElementProperties(DomProperties *a); - inline bool hasElementProperties() const { return m_children & Properties; } - void clearElementProperties(); - inline DomSlots *elementSlots() const { return m_slots; } DomSlots *takeElementSlots(); void setElementSlots(DomSlots *a); @@ -887,22 +721,19 @@ public: void clearElementPropertyspecifications(); private: - QString m_text; // child element data - uint m_children; + uint m_children = 0; QString m_class; QString m_extends; - DomHeader *m_header; - DomSize *m_sizeHint; + DomHeader *m_header = nullptr; + DomSize *m_sizeHint = nullptr; QString m_addPageMethod; - int m_container; - DomSizePolicyData *m_sizePolicy; + int m_container = 0; QString m_pixmap; - DomScript *m_script; - DomProperties *m_properties; - DomSlots *m_slots; - DomPropertySpecifications *m_propertyspecifications; + DomSlots *m_slots = nullptr; + DomPropertySpecifications *m_propertyspecifications = nullptr; + enum Child { Class = 1, Extends = 2, @@ -910,112 +741,20 @@ private: SizeHint = 8, AddPageMethod = 16, Container = 32, - SizePolicy = 64, - Pixmap = 128, - Script = 256, - Properties = 512, - Slots = 1024, - Propertyspecifications = 2048 - }; -}; - -class QDESIGNER_UILIB_EXPORT DomProperties { - Q_DISABLE_COPY(DomProperties) -public: - DomProperties(); - ~DomProperties(); - - void read(QXmlStreamReader &reader); - void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } - - // child element accessors - inline QVector elementProperty() const { return m_property; } - void setElementProperty(const QVector &a); - -private: - QString m_text; - - // child element data - uint m_children; - QVector m_property; - enum Child { - Property = 1 - }; -}; - -class QDESIGNER_UILIB_EXPORT DomPropertyData { - Q_DISABLE_COPY(DomPropertyData) -public: - DomPropertyData(); - ~DomPropertyData(); - - void read(QXmlStreamReader &reader); - void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } - - // attribute accessors - inline bool hasAttributeType() const { return m_has_attr_type; } - inline QString attributeType() const { return m_attr_type; } - inline void setAttributeType(const QString &a) { m_attr_type = a; m_has_attr_type = true; } - inline void clearAttributeType() { m_has_attr_type = false; } - -private: - QString m_text; - - // attribute data - QString m_attr_type; - bool m_has_attr_type; - -}; - -class QDESIGNER_UILIB_EXPORT DomSizePolicyData { - Q_DISABLE_COPY(DomSizePolicyData) -public: - DomSizePolicyData(); - ~DomSizePolicyData(); - - void read(QXmlStreamReader &reader); - void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } - - // child element accessors - inline int elementHorData() const { return m_horData; } - void setElementHorData(int a); - inline bool hasElementHorData() const { return m_children & HorData; } - void clearElementHorData(); - - inline int elementVerData() const { return m_verData; } - void setElementVerData(int a); - inline bool hasElementVerData() const { return m_children & VerData; } - void clearElementVerData(); - -private: - QString m_text; - - // child element data - uint m_children; - int m_horData; - int m_verData; - enum Child { - HorData = 1, - VerData = 2 + Pixmap = 64, + Slots = 128, + Propertyspecifications = 256 }; }; class QDESIGNER_UILIB_EXPORT DomLayoutDefault { Q_DISABLE_COPY(DomLayoutDefault) public: - DomLayoutDefault(); + DomLayoutDefault() = default; ~DomLayoutDefault(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } // attribute accessors inline bool hasAttributeSpacing() const { return m_has_attr_spacing; } @@ -1029,27 +768,22 @@ public: inline void clearAttributeMargin() { m_has_attr_margin = false; } private: - QString m_text; - // attribute data - int m_attr_spacing; - bool m_has_attr_spacing; - - int m_attr_margin; - bool m_has_attr_margin; + int m_attr_spacing = 0; + bool m_has_attr_spacing = false; + int m_attr_margin = 0; + bool m_has_attr_margin = false; }; class QDESIGNER_UILIB_EXPORT DomLayoutFunction { Q_DISABLE_COPY(DomLayoutFunction) public: - DomLayoutFunction(); + DomLayoutFunction() = default; ~DomLayoutFunction(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } // attribute accessors inline bool hasAttributeSpacing() const { return m_has_attr_spacing; } @@ -1063,38 +797,33 @@ public: inline void clearAttributeMargin() { m_has_attr_margin = false; } private: - QString m_text; - // attribute data QString m_attr_spacing; - bool m_has_attr_spacing; + bool m_has_attr_spacing = false; QString m_attr_margin; - bool m_has_attr_margin; - + bool m_has_attr_margin = false; }; class QDESIGNER_UILIB_EXPORT DomTabStops { Q_DISABLE_COPY(DomTabStops) public: - DomTabStops(); + DomTabStops() = default; ~DomTabStops(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } // child element accessors inline QStringList elementTabStop() const { return m_tabStop; } void setElementTabStop(const QStringList &a); private: - QString m_text; // child element data - uint m_children; + uint m_children = 0; QStringList m_tabStop; + enum Child { TabStop = 1 }; @@ -1103,13 +832,11 @@ private: class QDESIGNER_UILIB_EXPORT DomLayout { Q_DISABLE_COPY(DomLayout) public: - DomLayout(); + DomLayout() = default; ~DomLayout(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } // attribute accessors inline bool hasAttributeClass() const { return m_has_attr_class; } @@ -1158,35 +885,34 @@ public: void setElementItem(const QVector &a); private: - QString m_text; - // attribute data QString m_attr_class; - bool m_has_attr_class; + bool m_has_attr_class = false; QString m_attr_name; - bool m_has_attr_name; + bool m_has_attr_name = false; QString m_attr_stretch; - bool m_has_attr_stretch; + bool m_has_attr_stretch = false; QString m_attr_rowStretch; - bool m_has_attr_rowStretch; + bool m_has_attr_rowStretch = false; QString m_attr_columnStretch; - bool m_has_attr_columnStretch; + bool m_has_attr_columnStretch = false; QString m_attr_rowMinimumHeight; - bool m_has_attr_rowMinimumHeight; + bool m_has_attr_rowMinimumHeight = false; QString m_attr_columnMinimumWidth; - bool m_has_attr_columnMinimumWidth; + bool m_has_attr_columnMinimumWidth = false; // child element data - uint m_children; + uint m_children = 0; QList m_property; QList m_attribute; QVector m_item; + enum Child { Property = 1, Attribute = 2, @@ -1197,13 +923,11 @@ private: class QDESIGNER_UILIB_EXPORT DomLayoutItem { Q_DISABLE_COPY(DomLayoutItem) public: - DomLayoutItem(); + DomLayoutItem() = default; ~DomLayoutItem(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } // attribute accessors inline bool hasAttributeRow() const { return m_has_attr_row; } @@ -1248,54 +972,50 @@ public: void setElementSpacer(DomSpacer *a); private: - QString m_text; - void clear(); // attribute data - int m_attr_row; - bool m_has_attr_row; + int m_attr_row = 0; + bool m_has_attr_row = false; - int m_attr_column; - bool m_has_attr_column; + int m_attr_column = 0; + bool m_has_attr_column = false; - int m_attr_rowSpan; - bool m_has_attr_rowSpan; + int m_attr_rowSpan = 0; + bool m_has_attr_rowSpan = false; - int m_attr_colSpan; - bool m_has_attr_colSpan; + int m_attr_colSpan = 0; + bool m_has_attr_colSpan = false; QString m_attr_alignment; - bool m_has_attr_alignment; + bool m_has_attr_alignment = false; // child element data - Kind m_kind; - DomWidget *m_widget; - DomLayout *m_layout; - DomSpacer *m_spacer; + Kind m_kind = Unknown; + DomWidget *m_widget = nullptr; + DomLayout *m_layout = nullptr; + DomSpacer *m_spacer = nullptr; }; class QDESIGNER_UILIB_EXPORT DomRow { Q_DISABLE_COPY(DomRow) public: - DomRow(); + DomRow() = default; ~DomRow(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } // child element accessors inline QList elementProperty() const { return m_property; } void setElementProperty(const QList &a); private: - QString m_text; // child element data - uint m_children; + uint m_children = 0; QList m_property; + enum Child { Property = 1 }; @@ -1304,24 +1024,22 @@ private: class QDESIGNER_UILIB_EXPORT DomColumn { Q_DISABLE_COPY(DomColumn) public: - DomColumn(); + DomColumn() = default; ~DomColumn(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } // child element accessors inline QList elementProperty() const { return m_property; } void setElementProperty(const QList &a); private: - QString m_text; // child element data - uint m_children; + uint m_children = 0; QList m_property; + enum Child { Property = 1 }; @@ -1330,13 +1048,11 @@ private: class QDESIGNER_UILIB_EXPORT DomItem { Q_DISABLE_COPY(DomItem) public: - DomItem(); + DomItem() = default; ~DomItem(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } // attribute accessors inline bool hasAttributeRow() const { return m_has_attr_row; } @@ -1357,19 +1073,18 @@ public: void setElementItem(const QVector &a); private: - QString m_text; - // attribute data - int m_attr_row; - bool m_has_attr_row; + int m_attr_row = 0; + bool m_has_attr_row = false; - int m_attr_column; - bool m_has_attr_column; + int m_attr_column = 0; + bool m_has_attr_column = false; // child element data - uint m_children; + uint m_children = 0; QList m_property; QVector m_item; + enum Child { Property = 1, Item = 2 @@ -1379,13 +1094,11 @@ private: class QDESIGNER_UILIB_EXPORT DomWidget { Q_DISABLE_COPY(DomWidget) public: - DomWidget(); + DomWidget() = default; ~DomWidget(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } // attribute accessors inline bool hasAttributeClass() const { return m_has_attr_class; } @@ -1410,12 +1123,6 @@ public: inline QList elementProperty() const { return m_property; } void setElementProperty(const QList &a); - inline QVector elementScript() const { return m_script; } - void setElementScript(const QVector &a); - - inline QVector elementWidgetData() const { return m_widgetData; } - void setElementWidgetData(const QVector &a); - inline QList elementAttribute() const { return m_attribute; } void setElementAttribute(const QList &a); @@ -1447,24 +1154,20 @@ public: void setElementZOrder(const QStringList &a); private: - QString m_text; - // attribute data QString m_attr_class; - bool m_has_attr_class; + bool m_has_attr_class = false; QString m_attr_name; - bool m_has_attr_name; + bool m_has_attr_name = false; - bool m_attr_native; - bool m_has_attr_native; + bool m_attr_native = false; + bool m_has_attr_native = false; // child element data - uint m_children; + uint m_children = 0; QStringList m_class; QList m_property; - QVector m_script; - QVector m_widgetData; QList m_attribute; QVector m_row; QVector m_column; @@ -1475,34 +1178,31 @@ private: QVector m_actionGroup; QVector m_addAction; QStringList m_zOrder; + enum Child { Class = 1, Property = 2, - Script = 4, - WidgetData = 8, - Attribute = 16, - Row = 32, - Column = 64, - Item = 128, - Layout = 256, - Widget = 512, - Action = 1024, - ActionGroup = 2048, - AddAction = 4096, - ZOrder = 8192 + Attribute = 4, + Row = 8, + Column = 16, + Item = 32, + Layout = 64, + Widget = 128, + Action = 256, + ActionGroup = 512, + AddAction = 1024, + ZOrder = 2048 }; }; class QDESIGNER_UILIB_EXPORT DomSpacer { Q_DISABLE_COPY(DomSpacer) public: - DomSpacer(); + DomSpacer() = default; ~DomSpacer(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } // attribute accessors inline bool hasAttributeName() const { return m_has_attr_name; } @@ -1515,15 +1215,14 @@ public: void setElementProperty(const QList &a); private: - QString m_text; - // attribute data QString m_attr_name; - bool m_has_attr_name; + bool m_has_attr_name = false; // child element data - uint m_children; + uint m_children = 0; QList m_property; + enum Child { Property = 1 }; @@ -1532,13 +1231,11 @@ private: class QDESIGNER_UILIB_EXPORT DomColor { Q_DISABLE_COPY(DomColor) public: - DomColor(); + DomColor() = default; ~DomColor(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } // attribute accessors inline bool hasAttributeAlpha() const { return m_has_attr_alpha; } @@ -1563,17 +1260,16 @@ public: void clearElementBlue(); private: - QString m_text; - // attribute data - int m_attr_alpha; - bool m_has_attr_alpha; + int m_attr_alpha = 0; + bool m_has_attr_alpha = false; // child element data - uint m_children; - int m_red; - int m_green; - int m_blue; + uint m_children = 0; + int m_red = 0; + int m_green = 0; + int m_blue = 0; + enum Child { Red = 1, Green = 2, @@ -1584,13 +1280,11 @@ private: class QDESIGNER_UILIB_EXPORT DomGradientStop { Q_DISABLE_COPY(DomGradientStop) public: - DomGradientStop(); + DomGradientStop() = default; ~DomGradientStop(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } // attribute accessors inline bool hasAttributePosition() const { return m_has_attr_position; } @@ -1606,15 +1300,14 @@ public: void clearElementColor(); private: - QString m_text; - // attribute data - double m_attr_position; - bool m_has_attr_position; + double m_attr_position = 0.0; + bool m_has_attr_position = false; // child element data - uint m_children; - DomColor *m_color; + uint m_children = 0; + DomColor *m_color = nullptr; + enum Child { Color = 1 }; @@ -1623,13 +1316,11 @@ private: class QDESIGNER_UILIB_EXPORT DomGradient { Q_DISABLE_COPY(DomGradient) public: - DomGradient(); + DomGradient() = default; ~DomGradient(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } // attribute accessors inline bool hasAttributeStartX() const { return m_has_attr_startX; } @@ -1702,51 +1393,50 @@ public: void setElementGradientStop(const QVector &a); private: - QString m_text; - // attribute data - double m_attr_startX; - bool m_has_attr_startX; + double m_attr_startX = 0.0; + bool m_has_attr_startX = false; - double m_attr_startY; - bool m_has_attr_startY; + double m_attr_startY = 0.0; + bool m_has_attr_startY = false; - double m_attr_endX; - bool m_has_attr_endX; + double m_attr_endX = 0.0; + bool m_has_attr_endX = false; - double m_attr_endY; - bool m_has_attr_endY; + double m_attr_endY = 0.0; + bool m_has_attr_endY = false; - double m_attr_centralX; - bool m_has_attr_centralX; + double m_attr_centralX = 0.0; + bool m_has_attr_centralX = false; - double m_attr_centralY; - bool m_has_attr_centralY; + double m_attr_centralY = 0.0; + bool m_has_attr_centralY = false; - double m_attr_focalX; - bool m_has_attr_focalX; + double m_attr_focalX = 0.0; + bool m_has_attr_focalX = false; - double m_attr_focalY; - bool m_has_attr_focalY; + double m_attr_focalY = 0.0; + bool m_has_attr_focalY = false; - double m_attr_radius; - bool m_has_attr_radius; + double m_attr_radius = 0.0; + bool m_has_attr_radius = false; - double m_attr_angle; - bool m_has_attr_angle; + double m_attr_angle = 0.0; + bool m_has_attr_angle = false; QString m_attr_type; - bool m_has_attr_type; + bool m_has_attr_type = false; QString m_attr_spread; - bool m_has_attr_spread; + bool m_has_attr_spread = false; QString m_attr_coordinateMode; - bool m_has_attr_coordinateMode; + bool m_has_attr_coordinateMode = false; // child element data - uint m_children; + uint m_children = 0; QVector m_gradientStop; + enum Child { GradientStop = 1 }; @@ -1755,13 +1445,11 @@ private: class QDESIGNER_UILIB_EXPORT DomBrush { Q_DISABLE_COPY(DomBrush) public: - DomBrush(); + DomBrush() = default; ~DomBrush(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } // attribute accessors inline bool hasAttributeBrushStyle() const { return m_has_attr_brushStyle; } @@ -1786,31 +1474,27 @@ public: void setElementGradient(DomGradient *a); private: - QString m_text; - void clear(); // attribute data QString m_attr_brushStyle; - bool m_has_attr_brushStyle; + bool m_has_attr_brushStyle = false; // child element data - Kind m_kind; - DomColor *m_color; - DomProperty *m_texture; - DomGradient *m_gradient; + Kind m_kind = Unknown; + DomColor *m_color = nullptr; + DomProperty *m_texture = nullptr; + DomGradient *m_gradient = nullptr; }; class QDESIGNER_UILIB_EXPORT DomColorRole { Q_DISABLE_COPY(DomColorRole) public: - DomColorRole(); + DomColorRole() = default; ~DomColorRole(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } // attribute accessors inline bool hasAttributeRole() const { return m_has_attr_role; } @@ -1826,15 +1510,14 @@ public: void clearElementBrush(); private: - QString m_text; - // attribute data QString m_attr_role; - bool m_has_attr_role; + bool m_has_attr_role = false; // child element data - uint m_children; - DomBrush *m_brush; + uint m_children = 0; + DomBrush *m_brush = nullptr; + enum Child { Brush = 1 }; @@ -1843,13 +1526,11 @@ private: class QDESIGNER_UILIB_EXPORT DomColorGroup { Q_DISABLE_COPY(DomColorGroup) public: - DomColorGroup(); + DomColorGroup() = default; ~DomColorGroup(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } // child element accessors inline QVector elementColorRole() const { return m_colorRole; } @@ -1859,12 +1540,12 @@ public: void setElementColor(const QVector &a); private: - QString m_text; // child element data - uint m_children; + uint m_children = 0; QVector m_colorRole; QVector m_color; + enum Child { ColorRole = 1, Color = 2 @@ -1874,13 +1555,11 @@ private: class QDESIGNER_UILIB_EXPORT DomPalette { Q_DISABLE_COPY(DomPalette) public: - DomPalette(); + DomPalette() = default; ~DomPalette(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } // child element accessors inline DomColorGroup *elementActive() const { return m_active; } @@ -1902,13 +1581,13 @@ public: void clearElementDisabled(); private: - QString m_text; // child element data - uint m_children; - DomColorGroup *m_active; - DomColorGroup *m_inactive; - DomColorGroup *m_disabled; + uint m_children = 0; + DomColorGroup *m_active = nullptr; + DomColorGroup *m_inactive = nullptr; + DomColorGroup *m_disabled = nullptr; + enum Child { Active = 1, Inactive = 2, @@ -1919,13 +1598,11 @@ private: class QDESIGNER_UILIB_EXPORT DomFont { Q_DISABLE_COPY(DomFont) public: - DomFont(); + DomFont() = default; ~DomFont(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } // child element accessors inline QString elementFamily() const { return m_family; } @@ -1979,20 +1656,20 @@ public: void clearElementKerning(); private: - QString m_text; // child element data - uint m_children; + uint m_children = 0; QString m_family; - int m_pointSize; - int m_weight; - bool m_italic; - bool m_bold; - bool m_underline; - bool m_strikeOut; - bool m_antialiasing; + int m_pointSize = 0; + int m_weight = 0; + bool m_italic = false; + bool m_bold = false; + bool m_underline = false; + bool m_strikeOut = false; + bool m_antialiasing = false; QString m_styleStrategy; - bool m_kerning; + bool m_kerning = false; + enum Child { Family = 1, PointSize = 2, @@ -2010,13 +1687,11 @@ private: class QDESIGNER_UILIB_EXPORT DomPoint { Q_DISABLE_COPY(DomPoint) public: - DomPoint(); + DomPoint() = default; ~DomPoint(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } // child element accessors inline int elementX() const { return m_x; } @@ -2030,12 +1705,12 @@ public: void clearElementY(); private: - QString m_text; // child element data - uint m_children; - int m_x; - int m_y; + uint m_children = 0; + int m_x = 0; + int m_y = 0; + enum Child { X = 1, Y = 2 @@ -2045,13 +1720,11 @@ private: class QDESIGNER_UILIB_EXPORT DomRect { Q_DISABLE_COPY(DomRect) public: - DomRect(); + DomRect() = default; ~DomRect(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } // child element accessors inline int elementX() const { return m_x; } @@ -2075,14 +1748,14 @@ public: void clearElementHeight(); private: - QString m_text; // child element data - uint m_children; - int m_x; - int m_y; - int m_width; - int m_height; + uint m_children = 0; + int m_x = 0; + int m_y = 0; + int m_width = 0; + int m_height = 0; + enum Child { X = 1, Y = 2, @@ -2094,13 +1767,11 @@ private: class QDESIGNER_UILIB_EXPORT DomLocale { Q_DISABLE_COPY(DomLocale) public: - DomLocale(); + DomLocale() = default; ~DomLocale(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } // attribute accessors inline bool hasAttributeLanguage() const { return m_has_attr_language; } @@ -2114,27 +1785,22 @@ public: inline void clearAttributeCountry() { m_has_attr_country = false; } private: - QString m_text; - // attribute data QString m_attr_language; - bool m_has_attr_language; + bool m_has_attr_language = false; QString m_attr_country; - bool m_has_attr_country; - + bool m_has_attr_country = false; }; class QDESIGNER_UILIB_EXPORT DomSizePolicy { Q_DISABLE_COPY(DomSizePolicy) public: - DomSizePolicy(); + DomSizePolicy() = default; ~DomSizePolicy(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } // attribute accessors inline bool hasAttributeHSizeType() const { return m_has_attr_hSizeType; } @@ -2169,21 +1835,20 @@ public: void clearElementVerStretch(); private: - QString m_text; - // attribute data QString m_attr_hSizeType; - bool m_has_attr_hSizeType; + bool m_has_attr_hSizeType = false; QString m_attr_vSizeType; - bool m_has_attr_vSizeType; + bool m_has_attr_vSizeType = false; // child element data - uint m_children; - int m_hSizeType; - int m_vSizeType; - int m_horStretch; - int m_verStretch; + uint m_children = 0; + int m_hSizeType = 0; + int m_vSizeType = 0; + int m_horStretch = 0; + int m_verStretch = 0; + enum Child { HSizeType = 1, VSizeType = 2, @@ -2195,13 +1860,11 @@ private: class QDESIGNER_UILIB_EXPORT DomSize { Q_DISABLE_COPY(DomSize) public: - DomSize(); + DomSize() = default; ~DomSize(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } // child element accessors inline int elementWidth() const { return m_width; } @@ -2215,12 +1878,12 @@ public: void clearElementHeight(); private: - QString m_text; // child element data - uint m_children; - int m_width; - int m_height; + uint m_children = 0; + int m_width = 0; + int m_height = 0; + enum Child { Width = 1, Height = 2 @@ -2230,13 +1893,11 @@ private: class QDESIGNER_UILIB_EXPORT DomDate { Q_DISABLE_COPY(DomDate) public: - DomDate(); + DomDate() = default; ~DomDate(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } // child element accessors inline int elementYear() const { return m_year; } @@ -2255,13 +1916,13 @@ public: void clearElementDay(); private: - QString m_text; // child element data - uint m_children; - int m_year; - int m_month; - int m_day; + uint m_children = 0; + int m_year = 0; + int m_month = 0; + int m_day = 0; + enum Child { Year = 1, Month = 2, @@ -2272,13 +1933,11 @@ private: class QDESIGNER_UILIB_EXPORT DomTime { Q_DISABLE_COPY(DomTime) public: - DomTime(); + DomTime() = default; ~DomTime(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } // child element accessors inline int elementHour() const { return m_hour; } @@ -2297,13 +1956,13 @@ public: void clearElementSecond(); private: - QString m_text; // child element data - uint m_children; - int m_hour; - int m_minute; - int m_second; + uint m_children = 0; + int m_hour = 0; + int m_minute = 0; + int m_second = 0; + enum Child { Hour = 1, Minute = 2, @@ -2314,13 +1973,11 @@ private: class QDESIGNER_UILIB_EXPORT DomDateTime { Q_DISABLE_COPY(DomDateTime) public: - DomDateTime(); + DomDateTime() = default; ~DomDateTime(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } // child element accessors inline int elementHour() const { return m_hour; } @@ -2354,16 +2011,16 @@ public: void clearElementDay(); private: - QString m_text; // child element data - uint m_children; - int m_hour; - int m_minute; - int m_second; - int m_year; - int m_month; - int m_day; + uint m_children = 0; + int m_hour = 0; + int m_minute = 0; + int m_second = 0; + int m_year = 0; + int m_month = 0; + int m_day = 0; + enum Child { Hour = 1, Minute = 2, @@ -2377,13 +2034,11 @@ private: class QDESIGNER_UILIB_EXPORT DomStringList { Q_DISABLE_COPY(DomStringList) public: - DomStringList(); + DomStringList() = default; ~DomStringList(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } // attribute accessors inline bool hasAttributeNotr() const { return m_has_attr_notr; } @@ -2406,21 +2061,20 @@ public: void setElementString(const QStringList &a); private: - QString m_text; - // attribute data QString m_attr_notr; - bool m_has_attr_notr; + bool m_has_attr_notr = false; QString m_attr_comment; - bool m_has_attr_comment; + bool m_has_attr_comment = false; QString m_attr_extraComment; - bool m_has_attr_extraComment; + bool m_has_attr_extraComment = false; // child element data - uint m_children; + uint m_children = 0; QStringList m_string; + enum Child { String = 1 }; @@ -2429,11 +2083,12 @@ private: class QDESIGNER_UILIB_EXPORT DomResourcePixmap { Q_DISABLE_COPY(DomResourcePixmap) public: - DomResourcePixmap(); + DomResourcePixmap() = default; ~DomResourcePixmap(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; + inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -2453,21 +2108,21 @@ private: // attribute data QString m_attr_resource; - bool m_has_attr_resource; + bool m_has_attr_resource = false; QString m_attr_alias; - bool m_has_attr_alias; - + bool m_has_attr_alias = false; }; class QDESIGNER_UILIB_EXPORT DomResourceIcon { Q_DISABLE_COPY(DomResourceIcon) public: - DomResourceIcon(); + DomResourceIcon() = default; ~DomResourceIcon(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; + inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -2536,21 +2191,22 @@ private: // attribute data QString m_attr_theme; - bool m_has_attr_theme; + bool m_has_attr_theme = false; QString m_attr_resource; - bool m_has_attr_resource; + bool m_has_attr_resource = false; // child element data - uint m_children; - DomResourcePixmap *m_normalOff; - DomResourcePixmap *m_normalOn; - DomResourcePixmap *m_disabledOff; - DomResourcePixmap *m_disabledOn; - DomResourcePixmap *m_activeOff; - DomResourcePixmap *m_activeOn; - DomResourcePixmap *m_selectedOff; - DomResourcePixmap *m_selectedOn; + uint m_children = 0; + DomResourcePixmap *m_normalOff = nullptr; + DomResourcePixmap *m_normalOn = nullptr; + DomResourcePixmap *m_disabledOff = nullptr; + DomResourcePixmap *m_disabledOn = nullptr; + DomResourcePixmap *m_activeOff = nullptr; + DomResourcePixmap *m_activeOn = nullptr; + DomResourcePixmap *m_selectedOff = nullptr; + DomResourcePixmap *m_selectedOn = nullptr; + enum Child { NormalOff = 1, NormalOn = 2, @@ -2566,11 +2222,12 @@ private: class QDESIGNER_UILIB_EXPORT DomString { Q_DISABLE_COPY(DomString) public: - DomString(); + DomString() = default; ~DomString(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; + inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -2595,26 +2252,23 @@ private: // attribute data QString m_attr_notr; - bool m_has_attr_notr; + bool m_has_attr_notr = false; QString m_attr_comment; - bool m_has_attr_comment; + bool m_has_attr_comment = false; QString m_attr_extraComment; - bool m_has_attr_extraComment; - + bool m_has_attr_extraComment = false; }; class QDESIGNER_UILIB_EXPORT DomPointF { Q_DISABLE_COPY(DomPointF) public: - DomPointF(); + DomPointF() = default; ~DomPointF(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } // child element accessors inline double elementX() const { return m_x; } @@ -2628,12 +2282,12 @@ public: void clearElementY(); private: - QString m_text; // child element data - uint m_children; - double m_x; - double m_y; + uint m_children = 0; + double m_x = 0.0; + double m_y = 0.0; + enum Child { X = 1, Y = 2 @@ -2643,13 +2297,11 @@ private: class QDESIGNER_UILIB_EXPORT DomRectF { Q_DISABLE_COPY(DomRectF) public: - DomRectF(); + DomRectF() = default; ~DomRectF(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } // child element accessors inline double elementX() const { return m_x; } @@ -2673,14 +2325,14 @@ public: void clearElementHeight(); private: - QString m_text; // child element data - uint m_children; - double m_x; - double m_y; - double m_width; - double m_height; + uint m_children = 0; + double m_x = 0.0; + double m_y = 0.0; + double m_width = 0.0; + double m_height = 0.0; + enum Child { X = 1, Y = 2, @@ -2692,13 +2344,11 @@ private: class QDESIGNER_UILIB_EXPORT DomSizeF { Q_DISABLE_COPY(DomSizeF) public: - DomSizeF(); + DomSizeF() = default; ~DomSizeF(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } // child element accessors inline double elementWidth() const { return m_width; } @@ -2712,12 +2362,12 @@ public: void clearElementHeight(); private: - QString m_text; // child element data - uint m_children; - double m_width; - double m_height; + uint m_children = 0; + double m_width = 0.0; + double m_height = 0.0; + enum Child { Width = 1, Height = 2 @@ -2727,13 +2377,11 @@ private: class QDESIGNER_UILIB_EXPORT DomChar { Q_DISABLE_COPY(DomChar) public: - DomChar(); + DomChar() = default; ~DomChar(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } // child element accessors inline int elementUnicode() const { return m_unicode; } @@ -2742,11 +2390,11 @@ public: void clearElementUnicode(); private: - QString m_text; // child element data - uint m_children; - int m_unicode; + uint m_children = 0; + int m_unicode = 0; + enum Child { Unicode = 1 }; @@ -2755,13 +2403,11 @@ private: class QDESIGNER_UILIB_EXPORT DomUrl { Q_DISABLE_COPY(DomUrl) public: - DomUrl(); + DomUrl() = default; ~DomUrl(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } // child element accessors inline DomString *elementString() const { return m_string; } @@ -2771,11 +2417,11 @@ public: void clearElementString(); private: - QString m_text; // child element data - uint m_children; - DomString *m_string; + uint m_children = 0; + DomString *m_string = nullptr; + enum Child { String = 1 }; @@ -2784,13 +2430,11 @@ private: class QDESIGNER_UILIB_EXPORT DomProperty { Q_DISABLE_COPY(DomProperty) public: - DomProperty(); + DomProperty() = default; ~DomProperty(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } // attribute accessors inline bool hasAttributeName() const { return m_has_attr_name; } @@ -2928,75 +2572,71 @@ public: void setElementBrush(DomBrush *a); private: - QString m_text; - void clear(); // attribute data QString m_attr_name; - bool m_has_attr_name; + bool m_has_attr_name = false; - int m_attr_stdset; - bool m_has_attr_stdset; + int m_attr_stdset = 0; + bool m_has_attr_stdset = false; // child element data - Kind m_kind; + Kind m_kind = Unknown; QString m_bool; - DomColor *m_color; + DomColor *m_color = nullptr; QString m_cstring; - int m_cursor; + int m_cursor = 0; QString m_cursorShape; QString m_enum; - DomFont *m_font; - DomResourceIcon *m_iconSet; - DomResourcePixmap *m_pixmap; - DomPalette *m_palette; - DomPoint *m_point; - DomRect *m_rect; + DomFont *m_font = nullptr; + DomResourceIcon *m_iconSet = nullptr; + DomResourcePixmap *m_pixmap = nullptr; + DomPalette *m_palette = nullptr; + DomPoint *m_point = nullptr; + DomRect *m_rect = nullptr; QString m_set; - DomLocale *m_locale; - DomSizePolicy *m_sizePolicy; - DomSize *m_size; - DomString *m_string; - DomStringList *m_stringList; - int m_number; - float m_float; - double m_double; - DomDate *m_date; - DomTime *m_time; - DomDateTime *m_dateTime; - DomPointF *m_pointF; - DomRectF *m_rectF; - DomSizeF *m_sizeF; - qlonglong m_longLong; - DomChar *m_char; - DomUrl *m_url; - uint m_UInt; - qulonglong m_uLongLong; - DomBrush *m_brush; + DomLocale *m_locale = nullptr; + DomSizePolicy *m_sizePolicy = nullptr; + DomSize *m_size = nullptr; + DomString *m_string = nullptr; + DomStringList *m_stringList = nullptr; + int m_number = 0; + float m_float = 0.0; + double m_double = 0.0; + DomDate *m_date = nullptr; + DomTime *m_time = nullptr; + DomDateTime *m_dateTime = nullptr; + DomPointF *m_pointF = nullptr; + DomRectF *m_rectF = nullptr; + DomSizeF *m_sizeF = nullptr; + qlonglong m_longLong = 0; + DomChar *m_char = nullptr; + DomUrl *m_url = nullptr; + uint m_UInt = 0; + qulonglong m_uLongLong = 0; + DomBrush *m_brush = nullptr; }; class QDESIGNER_UILIB_EXPORT DomConnections { Q_DISABLE_COPY(DomConnections) public: - DomConnections(); + DomConnections() = default; ~DomConnections(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } // child element accessors inline QVector elementConnection() const { return m_connection; } void setElementConnection(const QVector &a); private: - QString m_text; // child element data - uint m_children; + uint m_children = 0; QVector m_connection; + enum Child { Connection = 1 }; @@ -3005,13 +2645,11 @@ private: class QDESIGNER_UILIB_EXPORT DomConnection { Q_DISABLE_COPY(DomConnection) public: - DomConnection(); + DomConnection() = default; ~DomConnection(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } // child element accessors inline QString elementSender() const { return m_sender; } @@ -3041,15 +2679,15 @@ public: void clearElementHints(); private: - QString m_text; // child element data - uint m_children; + uint m_children = 0; QString m_sender; QString m_signal; QString m_receiver; QString m_slot; - DomConnectionHints *m_hints; + DomConnectionHints *m_hints = nullptr; + enum Child { Sender = 1, Signal = 2, @@ -3062,24 +2700,22 @@ private: class QDESIGNER_UILIB_EXPORT DomConnectionHints { Q_DISABLE_COPY(DomConnectionHints) public: - DomConnectionHints(); + DomConnectionHints() = default; ~DomConnectionHints(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } // child element accessors inline QVector elementHint() const { return m_hint; } void setElementHint(const QVector &a); private: - QString m_text; // child element data - uint m_children; + uint m_children = 0; QVector m_hint; + enum Child { Hint = 1 }; @@ -3088,13 +2724,11 @@ private: class QDESIGNER_UILIB_EXPORT DomConnectionHint { Q_DISABLE_COPY(DomConnectionHint) public: - DomConnectionHint(); + DomConnectionHint() = default; ~DomConnectionHint(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } // attribute accessors inline bool hasAttributeType() const { return m_has_attr_type; } @@ -3114,103 +2748,40 @@ public: void clearElementY(); private: - QString m_text; - // attribute data QString m_attr_type; - bool m_has_attr_type; + bool m_has_attr_type = false; // child element data - uint m_children; - int m_x; - int m_y; + uint m_children = 0; + int m_x = 0; + int m_y = 0; + enum Child { X = 1, Y = 2 }; }; -class QDESIGNER_UILIB_EXPORT DomScript { - Q_DISABLE_COPY(DomScript) -public: - DomScript(); - ~DomScript(); - - void read(QXmlStreamReader &reader); - void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } - - // attribute accessors - inline bool hasAttributeSource() const { return m_has_attr_source; } - inline QString attributeSource() const { return m_attr_source; } - inline void setAttributeSource(const QString &a) { m_attr_source = a; m_has_attr_source = true; } - inline void clearAttributeSource() { m_has_attr_source = false; } - - inline bool hasAttributeLanguage() const { return m_has_attr_language; } - inline QString attributeLanguage() const { return m_attr_language; } - inline void setAttributeLanguage(const QString &a) { m_attr_language = a; m_has_attr_language = true; } - inline void clearAttributeLanguage() { m_has_attr_language = false; } - -private: - QString m_text; - - // attribute data - QString m_attr_source; - bool m_has_attr_source; - - QString m_attr_language; - bool m_has_attr_language; - -}; - -class QDESIGNER_UILIB_EXPORT DomWidgetData { - Q_DISABLE_COPY(DomWidgetData) -public: - DomWidgetData(); - ~DomWidgetData(); - - void read(QXmlStreamReader &reader); - void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } - - // child element accessors - inline QList elementProperty() const { return m_property; } - void setElementProperty(const QList &a); - -private: - QString m_text; - - // child element data - uint m_children; - QList m_property; - enum Child { - Property = 1 - }; -}; - class QDESIGNER_UILIB_EXPORT DomDesignerData { Q_DISABLE_COPY(DomDesignerData) public: - DomDesignerData(); + DomDesignerData() = default; ~DomDesignerData(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } // child element accessors inline QList elementProperty() const { return m_property; } void setElementProperty(const QList &a); private: - QString m_text; // child element data - uint m_children; + uint m_children = 0; QList m_property; + enum Child { Property = 1 }; @@ -3219,13 +2790,11 @@ private: class QDESIGNER_UILIB_EXPORT DomSlots { Q_DISABLE_COPY(DomSlots) public: - DomSlots(); + DomSlots() = default; ~DomSlots(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } // child element accessors inline QStringList elementSignal() const { return m_signal; } @@ -3235,12 +2804,12 @@ public: void setElementSlot(const QStringList &a); private: - QString m_text; // child element data - uint m_children; + uint m_children = 0; QStringList m_signal; QStringList m_slot; + enum Child { Signal = 1, Slot = 2 @@ -3250,13 +2819,11 @@ private: class QDESIGNER_UILIB_EXPORT DomPropertySpecifications { Q_DISABLE_COPY(DomPropertySpecifications) public: - DomPropertySpecifications(); + DomPropertySpecifications() = default; ~DomPropertySpecifications(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } // child element accessors inline QVector elementTooltip() const { return m_tooltip; } @@ -3266,12 +2833,12 @@ public: void setElementStringpropertyspecification(const QVector &a); private: - QString m_text; // child element data - uint m_children; + uint m_children = 0; QVector m_tooltip; QVector m_stringpropertyspecification; + enum Child { Tooltip = 1, Stringpropertyspecification = 2 @@ -3281,13 +2848,11 @@ private: class QDESIGNER_UILIB_EXPORT DomPropertyToolTip { Q_DISABLE_COPY(DomPropertyToolTip) public: - DomPropertyToolTip(); + DomPropertyToolTip() = default; ~DomPropertyToolTip(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } // attribute accessors inline bool hasAttributeName() const { return m_has_attr_name; } @@ -3296,24 +2861,19 @@ public: inline void clearAttributeName() { m_has_attr_name = false; } private: - QString m_text; - // attribute data QString m_attr_name; - bool m_has_attr_name; - + bool m_has_attr_name = false; }; class QDESIGNER_UILIB_EXPORT DomStringPropertySpecification { Q_DISABLE_COPY(DomStringPropertySpecification) public: - DomStringPropertySpecification(); + DomStringPropertySpecification() = default; ~DomStringPropertySpecification(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } // attribute accessors inline bool hasAttributeName() const { return m_has_attr_name; } @@ -3332,18 +2892,15 @@ public: inline void clearAttributeNotr() { m_has_attr_notr = false; } private: - QString m_text; - // attribute data QString m_attr_name; - bool m_has_attr_name; + bool m_has_attr_name = false; QString m_attr_type; - bool m_has_attr_type; + bool m_has_attr_type = false; QString m_attr_notr; - bool m_has_attr_notr; - + bool m_has_attr_notr = false; }; diff --git a/src/tools/uic/uic.cpp b/src/tools/uic/uic.cpp index fa775161e5..48756db651 100644 --- a/src/tools/uic/uic.cpp +++ b/src/tools/uic/uic.cpp @@ -52,8 +52,7 @@ QT_BEGIN_NAMESPACE Uic::Uic(Driver *d) : drv(d), out(d->output()), - opt(d->option()), - externalPix(true) + opt(d->option()) { } @@ -253,15 +252,13 @@ bool Uic::write(DomUI *ui) if (pixFunction == QLatin1String("QPixmap::fromMimeSource")) pixFunction = QLatin1String("qPixmapFromMimeSource"); - externalPix = ui->elementImages() == 0; - info.acceptUI(ui); cWidgetsInfo.acceptUI(ui); WriteIncludes writeIncludes(this); writeIncludes.acceptUI(ui); Validator(this).acceptUI(ui); - WriteDeclaration(this, writeIncludes.scriptsActivated()).acceptUI(ui); + WriteDeclaration(this).acceptUI(ui); if (opt.headerProtection) writeHeaderProtectionEnd(); diff --git a/src/tools/uic/uic.h b/src/tools/uic/uic.h index 10404d3370..e00dc595bc 100644 --- a/src/tools/uic/uic.h +++ b/src/tools/uic/uic.h @@ -74,12 +74,6 @@ public: inline void setPixmapFunction(const QString &f) { pixFunction = f; } - inline bool hasExternalPixmap() const - { return externalPix; } - - inline void setExternalPixmap(bool b) - { externalPix = b; } - inline const DatabaseInfo *databaseInfo() const { return &info; } @@ -123,7 +117,6 @@ private: DatabaseInfo info; CustomWidgetsInfo cWidgetsInfo; QString pixFunction; - bool externalPix; }; QT_END_NAMESPACE