summaryrefslogtreecommitdiffstats
path: root/src/designer/src/lib/uilib
diff options
context:
space:
mode:
Diffstat (limited to 'src/designer/src/lib/uilib')
-rw-r--r--src/designer/src/lib/uilib/abstractformbuilder.cpp427
-rw-r--r--src/designer/src/lib/uilib/abstractformbuilder.h46
-rw-r--r--src/designer/src/lib/uilib/formbuilder.cpp85
-rw-r--r--src/designer/src/lib/uilib/formbuilder.h50
-rw-r--r--src/designer/src/lib/uilib/formbuilderextra.cpp196
-rw-r--r--src/designer/src/lib/uilib/formbuilderextra_p.h111
-rw-r--r--src/designer/src/lib/uilib/properties.cpp164
-rw-r--r--src/designer/src/lib/uilib/properties_p.h46
-rw-r--r--src/designer/src/lib/uilib/resourcebuilder.cpp143
-rw-r--r--src/designer/src/lib/uilib/resourcebuilder_p.h45
-rw-r--r--src/designer/src/lib/uilib/textbuilder.cpp40
-rw-r--r--src/designer/src/lib/uilib/textbuilder_p.h40
-rw-r--r--src/designer/src/lib/uilib/ui4.cpp1303
-rw-r--r--src/designer/src/lib/uilib/ui4_p.h56
-rw-r--r--src/designer/src/lib/uilib/uilib_global.h40
-rw-r--r--src/designer/src/lib/uilib/widgets.table5
16 files changed, 1176 insertions, 1621 deletions
diff --git a/src/designer/src/lib/uilib/abstractformbuilder.cpp b/src/designer/src/lib/uilib/abstractformbuilder.cpp
index d460c013c..01feb1a7c 100644
--- a/src/designer/src/lib/uilib/abstractformbuilder.cpp
+++ b/src/designer/src/lib/uilib/abstractformbuilder.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** 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-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "abstractformbuilder.h"
#include "formbuilderextra_p.h"
@@ -92,14 +56,23 @@
Q_DECLARE_METATYPE(QWidgetList)
-static const char *buttonGroupPropertyC = "buttonGroup";
-
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
+static constexpr auto buttonGroupPropertyC = "buttonGroup"_L1;
+
#ifdef QFORMINTERNAL_NAMESPACE
using namespace QFormInternal;
#endif
+using QFBE = QFormBuilderExtra;
+
+static inline DomProperty *currentIndexProperty(const QList<DomProperty*> &properties)
+{
+ return QFBE::propertyByName(properties, "currentIndex");
+}
+
class QFriendlyLayout: public QLayout
{
public:
@@ -127,7 +100,7 @@ public:
QFormBuilder class to create user interfaces from UI files at
run-time. For example:
- \snippet lib/tools_designer_src_lib_uilib_abstractformbuilder.cpp 0
+ \snippet lib/tools_designer_src_lib_uilib_formbuilder.cpp 0
To override certain aspects of the form builder's behavior,
subclass QAbstractFormBuilder and reimplement the relevant virtual
@@ -188,8 +161,6 @@ QWidget *QAbstractFormBuilder::load(QIODevice *dev, QWidget *parentWidget)
*/
QWidget *QAbstractFormBuilder::create(DomUI *ui, QWidget *parentWidget)
{
- using ButtonGroupHash = QFormBuilderExtra::ButtonGroupHash;
-
d->clear();
if (const DomLayoutDefault *def = ui->elementLayoutDefault()) {
d->m_defaultMargin = def->hasAttributeMargin() ? def->attributeMargin() : INT_MIN;
@@ -207,12 +178,9 @@ QWidget *QAbstractFormBuilder::create(DomUI *ui, QWidget *parentWidget)
if (QWidget *widget = create(ui_widget, parentWidget)) {
// Reparent button groups that were actually created to main container for them to be found in the signal/slot part
- const ButtonGroupHash &buttonGroups = d->buttonGroups();
- if (!buttonGroups.isEmpty()) {
- const ButtonGroupHash::const_iterator cend = buttonGroups.constEnd();
- for (ButtonGroupHash::const_iterator it = buttonGroups.constBegin(); it != cend; ++it)
- if (it.value().second)
- it.value().second->setParent(widget);
+ for (const auto &bg : std::as_const(d->buttonGroups())) {
+ if (bg.second)
+ bg.second->setParent(widget);
}
createConnections(ui->elementConnections(), widget);
createResources(ui->elementResources()); // maybe this should go first, before create()...
@@ -287,10 +255,9 @@ QWidget *QAbstractFormBuilder::create(DomWidget *ui_widget, QWidget *parentWidge
const auto &addActions = ui_widget->elementAddAction();
if (!addActions.isEmpty()) {
- const QFormBuilderStrings &strings = QFormBuilderStrings::instance();
for (DomActionRef *ui_action_ref : addActions) {
const QString name = ui_action_ref->attributeName();
- if (name == strings.separator) {
+ if (name == "separator"_L1) {
QAction *sep = new QAction(w);
sep->setSeparator(true);
w->addAction(sep);
@@ -372,8 +339,9 @@ QActionGroup *QAbstractFormBuilder::create(DomActionGroup *ui_action_group, QObj
// figure out the toolbar area of a DOM attrib list.
// By legacy, it is stored as an integer. As of 4.3.0, it is the enumeration value.
-Qt::ToolBarArea QAbstractFormBuilder::toolbarAreaFromDOMAttributes(const DomPropertyHash &attributes) {
- const DomProperty *attr = attributes.value(QFormBuilderStrings::instance().toolBarAreaAttribute);
+Qt::ToolBarArea QAbstractFormBuilder::toolbarAreaFromDOMAttributes(const DomPropertyHash &attributes)
+{
+ const DomProperty *attr = attributes.value("toolBarArea"_L1);
if (!attr)
return Qt::TopToolBarArea;
switch(attr->kind()) {
@@ -393,13 +361,12 @@ Qt::ToolBarArea QAbstractFormBuilder::toolbarAreaFromDOMAttributes(const DomProp
*/
bool QAbstractFormBuilder::addItem(DomWidget *ui_widget, QWidget *widget, QWidget *parentWidget)
{
- const QFormBuilderStrings &strings = QFormBuilderStrings::instance();
const DomPropertyHash attributes = propertyMap(ui_widget->elementAttribute());
if (parentWidget == nullptr)
return true;
// Check special cases. First: Custom container
- const QString className = QLatin1String(parentWidget->metaObject()->className());
+ const QString className = QLatin1StringView(parentWidget->metaObject()->className());
const QString addPageMethod = d->customWidgetAddPageMethod(className);
if (!addPageMethod.isEmpty()) {
// If this fails ( non-existent or non-slot), use ContainerExtension in Designer, else it can't be helped
@@ -421,8 +388,8 @@ bool QAbstractFormBuilder::addItem(DomWidget *ui_widget, QWidget *widget, QWidge
if (QToolBar *toolBar = qobject_cast<QToolBar*>(widget)) {
mw->addToolBar(toolbarAreaFromDOMAttributes(attributes), toolBar);
// check break
- if (const DomProperty *attr = attributes.value(strings.toolBarBreakAttribute))
- if (attr->elementBool() == strings.trueValue)
+ if (const DomProperty *attr = attributes.value("toolBarBreak"_L1))
+ if (attr->elementBool() == "true"_L1)
mw->insertToolBarBreak (toolBar);
return true;
@@ -440,7 +407,7 @@ bool QAbstractFormBuilder::addItem(DomWidget *ui_widget, QWidget *widget, QWidge
#if QT_CONFIG(dockwidget)
// apply the dockwidget's attributes
if (QDockWidget *dockWidget = qobject_cast<QDockWidget*>(widget)) {
- if (const DomProperty *attr = attributes.value(strings.dockWidgetAreaAttribute)) {
+ if (const DomProperty *attr = attributes.value("dockWidgetArea"_L1)) {
Qt::DockWidgetArea area = static_cast<Qt::DockWidgetArea>(attr->elementNumber());
if (!dockWidget->isAreaAllowed(area)) {
if (dockWidget->isAreaAllowed(Qt::LeftDockWidgetArea))
@@ -471,25 +438,25 @@ bool QAbstractFormBuilder::addItem(DomWidget *ui_widget, QWidget *widget, QWidge
widget->setParent(nullptr);
const int tabIndex = tabWidget->count();
- if (const DomProperty *titleP = attributes.value(strings.titleAttribute, 0))
+ if (auto *titleP = attributes.value(QFormBuilderStrings::titleAttribute))
tabWidget->addTab(widget, toString(titleP->elementString()));
else
- tabWidget->addTab(widget, strings.defaultTitle);
+ tabWidget->addTab(widget, "Page"_L1);
- if (DomProperty *picon = attributes.value(strings.iconAttribute)) {
+ if (const auto *picon = attributes.value(QFormBuilderStrings::iconAttribute)) {
QVariant v = resourceBuilder()->loadResource(workingDirectory(), picon);
QVariant nativeValue = resourceBuilder()->toNativeValue(v);
tabWidget->setTabIcon(tabIndex, qvariant_cast<QIcon>(nativeValue));
}
#if QT_CONFIG(tooltip)
- if (const DomProperty *ptoolTip = attributes.value(strings.toolTipAttribute)) {
+ if (const auto *ptoolTip = attributes.value(QFormBuilderStrings::toolTipAttribute)) {
tabWidget->setTabToolTip(tabIndex, toString(ptoolTip->elementString()));
}
#endif
#if QT_CONFIG(whatsthis)
- if (const DomProperty *pwhatsThis = attributes.value(strings.whatsThisAttribute)) {
+ if (const auto *pwhatsThis = attributes.value(QFormBuilderStrings::whatsThisAttribute)) {
tabWidget->setTabWhatsThis(tabIndex, toString(pwhatsThis->elementString()));
}
#endif
@@ -501,19 +468,19 @@ bool QAbstractFormBuilder::addItem(DomWidget *ui_widget, QWidget *widget, QWidge
#if QT_CONFIG(toolbox)
else if (QToolBox *toolBox = qobject_cast<QToolBox*>(parentWidget)) {
const int tabIndex = toolBox->count();
- if (const DomProperty *labelP = attributes.value(strings.labelAttribute, 0))
+ if (const auto *labelP = attributes.value(QFormBuilderStrings::labelAttribute))
toolBox->addItem(widget, toString(labelP->elementString()));
else
- toolBox->addItem(widget, strings.defaultTitle);
+ toolBox->addItem(widget, "Page"_L1);
- if (DomProperty *picon = attributes.value(strings.iconAttribute)) {
+ if (const auto *picon = attributes.value(QFormBuilderStrings::iconAttribute)) {
QVariant v = resourceBuilder()->loadResource(workingDirectory(), picon);
QVariant nativeValue = resourceBuilder()->toNativeValue(v);
toolBox->setItemIcon(tabIndex, qvariant_cast<QIcon>(nativeValue));
}
#if QT_CONFIG(tooltip)
- if (const DomProperty *ptoolTip = attributes.value(strings.toolTipAttribute)) {
+ if (const auto *ptoolTip = attributes.value(QFormBuilderStrings::toolTipAttribute)) {
toolBox->setItemToolTip(tabIndex, toString(ptoolTip->elementString()));
}
#endif
@@ -577,15 +544,13 @@ bool QAbstractFormBuilder::addItem(DomWidget *ui_widget, QWidget *widget, QWidge
void QAbstractFormBuilder::layoutInfo(DomLayout *ui_layout, QObject *parent, int *margin, int *spacing)
{
Q_UNUSED(parent);
- const QFormBuilderStrings &strings = QFormBuilderStrings::instance();
- const DomPropertyHash properties = propertyMap(ui_layout->elementProperty());
+ auto properties = ui_layout->elementProperty();
int mar = INT_MIN;
int spac = INT_MIN;
- if (const DomProperty *p = properties.value(strings.marginProperty, 0))
+ if (const DomProperty *p = QFBE::propertyByName(properties, "margin"))
mar = p->elementNumber();
-
- if (const DomProperty *p = properties.value(strings.spacingProperty, 0))
+ if (const DomProperty *p = QFBE::propertyByName(properties, "spacing"))
spac = p->elementNumber();
#ifdef Q_OS_MACOS
@@ -598,11 +563,10 @@ void QAbstractFormBuilder::layoutInfo(DomLayout *ui_layout, QObject *parent, int
spac = INT_MIN;
if (mar == INT_MIN || spac == INT_MIN) {
- auto properties = ui_layout->elementProperty();
for (auto it = properties.begin(); it != properties.end(); ) {
DomProperty *prop = *it;
- if ((mar == INT_MIN && prop->attributeName() == strings.marginProperty)
- || (spac == INT_MIN && prop->attributeName() == strings.spacingProperty)) {
+ if ((mar == INT_MIN && prop->attributeName() == "margin"_L1)
+ || (spac == INT_MIN && prop->attributeName() == "spacing"_L1)) {
delete prop;
it = properties.erase(it);
} else {
@@ -663,25 +627,10 @@ QLayout *QAbstractFormBuilder::create(DomLayout *ui_layout, QLayout *parentLayou
if (margin != INT_MIN) {
layout->setContentsMargins(margin, margin, margin, margin);
} else {
- const QFormBuilderStrings &strings = QFormBuilderStrings::instance();
- int left, top, right, bottom;
- left = top = right = bottom = -1;
+ int left = -1, top = -1, right = -1, bottom = -1;
layout->getContentsMargins(&left, &top, &right, &bottom);
-
- const DomPropertyHash properties = propertyMap(ui_layout->elementProperty());
-
- if (const DomProperty *p = properties.value(strings.leftMarginProperty, 0))
- left = p->elementNumber();
-
- if (const DomProperty *p = properties.value(strings.topMarginProperty, 0))
- top = p->elementNumber();
-
- if (const DomProperty *p = properties.value(strings.rightMarginProperty, 0))
- right = p->elementNumber();
-
- if (const DomProperty *p = properties.value(strings.bottomMarginProperty, 0))
- bottom = p->elementNumber();
-
+ QFormBuilderExtra::getLayoutMargins(ui_layout->elementProperty(),
+ &left, &top, &right, &bottom);
layout->setContentsMargins(left, top, right, bottom);
}
@@ -690,12 +639,10 @@ QLayout *QAbstractFormBuilder::create(DomLayout *ui_layout, QLayout *parentLayou
} else {
QGridLayout *grid = qobject_cast<QGridLayout *>(layout);
if (grid) {
- const QFormBuilderStrings &strings = QFormBuilderStrings::instance();
- const DomPropertyHash properties = propertyMap(ui_layout->elementProperty());
-
- if (const DomProperty *p = properties.value(strings.horizontalSpacingProperty, 0))
+ const auto &properties = ui_layout->elementProperty();
+ if (const auto *p = QFBE::propertyByName(properties, "horizontalSpacing"))
grid->setHorizontalSpacing(p->elementNumber());
- if (const DomProperty *p = properties.value(strings.verticalSpacingProperty, 0))
+ if (const auto *p = QFBE::propertyByName(properties, "verticalSpacing"))
grid->setVerticalSpacing(p->elementNumber());
}
}
@@ -745,61 +692,55 @@ static inline QFormLayout::ItemRole formLayoutRole(int column, int colspan)
static inline QString alignmentValue(Qt::Alignment a)
{
- QString h,v;
+ QLatin1StringView h;
+ QLatin1StringView v;
switch (a & Qt::AlignHorizontal_Mask) {
case Qt::AlignLeft:
- h = QStringLiteral("Qt::AlignLeft");
+ h = "Qt::AlignmentFlag::AlignLeft"_L1;
break;
case Qt::AlignRight:
- h = QStringLiteral("Qt::AlignRight");
+ h = "Qt::AlignmentFlag::AlignRight"_L1;
break;
case Qt::AlignHCenter:
- h = QStringLiteral("Qt::AlignHCenter");
+ h = "Qt::AlignmentFlag::AlignHCenter"_L1;
break;
case Qt::AlignJustify:
- h = QStringLiteral("Qt::AlignJustify");
+ h = "Qt::AlignmentFlag::AlignJustify"_L1;
break;
}
switch (a & Qt::AlignVertical_Mask) {
case Qt::AlignTop:
- v = QStringLiteral("Qt::AlignTop");
+ v = "Qt::AlignmentFlag::AlignTop"_L1;
break;
case Qt::AlignBottom:
- v = QStringLiteral("Qt::AlignBottom");
+ v = "Qt::AlignmentFlag::AlignBottom"_L1;
break;
case Qt::AlignVCenter:
- v = QStringLiteral("Qt::AlignVCenter");
+ v = "Qt::AlignmentFlag::AlignVCenter"_L1;
break;
}
- if (h.isEmpty() && v.isEmpty())
- return QString();
- if (!v.isEmpty()) {
- if (!h.isEmpty())
- h += QLatin1Char('|');
- h += v;
- }
- return h;
+
+ return h + (v.isEmpty() || h.isEmpty() ? ""_L1 : "|"_L1) + v;
}
static inline Qt::Alignment alignmentFromDom(const QString &in)
{
Qt::Alignment rc;
if (!in.isEmpty()) {
- const auto flags = QStringView{in}.split(QLatin1Char('|'));
- for (const auto &f : flags) {
- if (f == QStringLiteral("Qt::AlignLeft")) {
+ for (const auto &f : qTokenize(in, u'|')) {
+ if (f.endsWith("::AlignLeft"_L1)) {
rc |= Qt::AlignLeft;
- } else if (f == QStringLiteral("Qt::AlignRight")) {
+ } else if (f.endsWith("::AlignRight"_L1)) {
rc |= Qt::AlignRight;
- } else if (f == QStringLiteral("Qt::AlignHCenter")) {
+ } else if (f.endsWith("::AlignHCenter"_L1)) {
rc |= Qt::AlignHCenter;
- } else if (f == QStringLiteral("Qt::AlignJustify")) {
+ } else if (f.endsWith("::AlignJustify"_L1)) {
rc |= Qt::AlignJustify;
- } else if (f == QStringLiteral("Qt::AlignTop")) {
+ } else if (f.endsWith("::AlignTop"_L1)) {
rc |= Qt::AlignTop;
- } else if (f == QStringLiteral("Qt::AlignBottom")) {
+ } else if (f.endsWith("::AlignBottom"_L1)) {
rc |= Qt::AlignBottom;
- } else if (f == QStringLiteral("Qt::AlignVCenter")) {
+ } else if (f.endsWith("::AlignVCenter"_L1)) {
rc |= Qt::AlignVCenter;
}
}
@@ -871,16 +812,15 @@ QLayoutItem *QAbstractFormBuilder::create(DomLayoutItem *ui_layoutItem, QLayout
const DomSpacer *ui_spacer = ui_layoutItem->elementSpacer();
const auto &spacerProperties = ui_spacer->elementProperty();
if (!spacerProperties.isEmpty()) {
- const QFormBuilderStrings &strings = QFormBuilderStrings::instance();
for (DomProperty *p : spacerProperties) {
const QVariant v = toVariant(&QAbstractFormBuilderGadget::staticMetaObject, p); // ### remove me
if (v.isNull())
continue;
- if (p->attributeName() == strings.sizeHintProperty && p->kind() == DomProperty::Size) {
+ if (p->attributeName() == "sizeHint"_L1 && p->kind() == DomProperty::Size) {
size = v.toSize(); // ### remove me
- } else if (p->attributeName() == strings.sizeTypeProperty && p->kind() == DomProperty::Enum) {
+ } else if (p->attributeName() == "sizeType"_L1 && p->kind() == DomProperty::Enum) {
sizeType = static_cast<QSizePolicy::Policy>(v.toInt());
- } else if (p->attributeName() == strings.orientationProperty && p->kind() == DomProperty::Enum) {
+ } else if (p->attributeName() == "orientation"_L1 && p->kind() == DomProperty::Enum) {
const Qt::Orientation o = static_cast<Qt::Orientation>(v.toInt());
isVspacer = (o == Qt::Vertical);
}
@@ -913,8 +853,8 @@ void QAbstractFormBuilder::applyProperties(QObject *o, const QList<DomProperty*>
const QVariant v = toVariant(o->metaObject(), p);
if (!v.isNull()) {
QString attributeName = p->attributeName();
- if (attributeName == QLatin1String("numDigits") && o->inherits("QLCDNumber")) // Deprecated in Qt 4, removed in Qt 5.
- attributeName = QLatin1String("digitCount");
+ if (attributeName == "numDigits"_L1 && o->inherits("QLCDNumber")) // Deprecated in Qt 4, removed in Qt 5.
+ attributeName = u"digitCount"_s;
if (!d->applyPropertyInternally(o, attributeName, v))
o->setProperty(attributeName.toUtf8(), v);
}
@@ -1021,7 +961,7 @@ QActionGroup *QAbstractFormBuilder::createActionGroup(QObject *parent, const QSt
Saves an XML representation of the given \a widget to the
specified \a device in the standard UI file format.
- \note Unlike when saving a form in Qt Designer, all property values are
+ \note Unlike when saving a form in \QD, all property values are
written. This is because, the state of whether a property value was
modified or not isn't stored in the Qt property system. The widget that
is being saved, could have been created dynamically, not loaded via
@@ -1044,7 +984,7 @@ void QAbstractFormBuilder::save(QIODevice *dev, QWidget *widget)
Q_ASSERT( ui_widget != nullptr );
DomUI *ui = new DomUI();
- ui->setAttributeVersion(QStringLiteral("4.0"));
+ ui->setAttributeVersion(u"4.0"_s);
ui->setElementWidget(ui_widget);
saveDom(ui, widget);
@@ -1102,7 +1042,7 @@ DomConnections *QAbstractFormBuilder::saveConnections()
DomWidget *QAbstractFormBuilder::createDom(QWidget *widget, DomWidget *ui_parentWidget, bool recursive)
{
DomWidget *ui_widget = new DomWidget();
- ui_widget->setAttributeClass(QLatin1String(widget->metaObject()->className()));
+ ui_widget->setAttributeClass(QLatin1StringView(widget->metaObject()->className()));
ui_widget->setAttributeName(widget->objectName());
ui_widget->setElementProperty(computeProperties(widget));
@@ -1157,7 +1097,7 @@ DomWidget *QAbstractFormBuilder::createDom(QWidget *widget, DomWidget *ui_parent
}
}
- for (QObject *obj : qAsConst(children)) {
+ for (QObject *obj : std::as_const(children)) {
if (QWidget *childWidget = qobject_cast<QWidget*>(obj)) {
if (d->m_laidout.contains(childWidget) || !recursive)
continue;
@@ -1217,16 +1157,14 @@ DomWidget *QAbstractFormBuilder::createDom(QWidget *widget, DomWidget *ui_parent
*/
DomActionRef *QAbstractFormBuilder::createActionRefDom(QAction *action)
{
- QString name = action->objectName();
-
- if (action->menu() != nullptr)
- name = action->menu()->objectName();
-
DomActionRef *ui_action_ref = new DomActionRef();
- if (action->isSeparator())
- ui_action_ref->setAttributeName(QFormBuilderStrings::instance().separator);
- else
- ui_action_ref->setAttributeName(name);
+ if (action->isSeparator()) {
+ ui_action_ref->setAttributeName("separator"_L1);
+ } else {
+ ui_action_ref->setAttributeName(action->menu() != nullptr
+ ? action->menu()->objectName()
+ : action->objectName());
+ }
return ui_action_ref;
}
@@ -1328,7 +1266,7 @@ DomLayout *QAbstractFormBuilder::createDom(QLayout *layout, DomLayout *ui_layout
{
Q_UNUSED(ui_layout);
DomLayout *lay = new DomLayout();
- lay->setAttributeClass(QLatin1String(layout->metaObject()->className()));
+ lay->setAttributeClass(QLatin1StringView(layout->metaObject()->className()));
const QString objectName = layout->objectName();
if (!objectName.isEmpty())
lay->setAttributeName(objectName);
@@ -1347,7 +1285,7 @@ DomLayout *QAbstractFormBuilder::createDom(QLayout *layout, DomLayout *ui_layout
QList<DomLayoutItem *> ui_items;
ui_items.reserve(newList.size());
- for (const FormBuilderSaveLayoutEntry &item : qAsConst(newList)) {
+ for (const FormBuilderSaveLayoutEntry &item : std::as_const(newList)) {
if (DomLayoutItem *ui_item = createDom(item.item, lay, ui_parentWidget)) {
if (item.row >= 0)
ui_item->setAttributeRow(item.row);
@@ -1399,10 +1337,9 @@ DomSpacer *QAbstractFormBuilder::createDom(QSpacerItem *spacer, DomLayout *ui_la
QList<DomProperty*> properties;
DomProperty *prop = nullptr;
- const QFormBuilderStrings &strings = QFormBuilderStrings::instance();
// sizeHint property
prop = new DomProperty();
- prop->setAttributeName(strings.sizeHintProperty);
+ prop->setAttributeName("sizeHint"_L1);
prop->setElementSize(new DomSize());
prop->elementSize()->setElementWidth(spacer->sizeHint().width());
prop->elementSize()->setElementHeight(spacer->sizeHint().height());
@@ -1410,8 +1347,9 @@ DomSpacer *QAbstractFormBuilder::createDom(QSpacerItem *spacer, DomLayout *ui_la
// orientation property
prop = new DomProperty(); // ### we don't implemented the case where expandingDirections() is both Vertical and Horizontal
- prop->setAttributeName(strings.orientationProperty);
- prop->setElementEnum((spacer->expandingDirections() & Qt::Horizontal) ? strings.qtHorizontal : strings.qtVertical);
+ prop->setAttributeName("orientation"_L1);
+ prop->setElementEnum((spacer->expandingDirections() & Qt::Horizontal) != 0 ?
+ "Qt:::Orientation::Horizontal"_L1 : "Qt:::Orientation::Vertical"_L1);
properties.append(prop);
ui_spacer->setElementProperty(properties);
@@ -1450,7 +1388,7 @@ QList<DomProperty*> QAbstractFormBuilder::computeProperties(QObject *obj)
const QString pname = QString::fromUtf8(propertyNames.at(i));
const QMetaProperty prop = meta->property(meta->indexOfProperty(pname.toUtf8()));
- if (!prop.isWritable() || !checkProperty(obj, QLatin1String(prop.name())))
+ if (!prop.isWritable() || !checkProperty(obj, QLatin1StringView(prop.name())))
continue;
const QVariant v = prop.read(obj);
@@ -1465,7 +1403,7 @@ QList<DomProperty*> QAbstractFormBuilder::computeProperties(QObject *obj)
if (prop.isEnumType()) {
QString scope = QString::fromUtf8(prop.enumerator().scope());
if (scope.size())
- scope += QString::fromUtf8("::");
+ scope += "::"_L1;
const QString e = QString::fromUtf8(prop.enumerator().valueToKey(v.toInt()));
if (e.size())
dom_prop->setElementEnum(scope + e);
@@ -1611,13 +1549,12 @@ public:
template<class T>
static void storeItemFlags(const T *item, QList<DomProperty*> *properties)
{
- static const QFormBuilderStrings &strings = QFormBuilderStrings::instance();
static const Qt::ItemFlags defaultFlags = T().flags();
static const QMetaEnum itemFlags_enum = metaEnum<QAbstractFormBuilderGadget>("itemFlags");
if (item->flags() != defaultFlags) {
DomProperty *p = new DomProperty;
- p->setAttributeName(strings.flagsAttribute);
+ p->setAttributeName(QFormBuilderStrings::flagsAttribute);
p->setElementSet(QString::fromLatin1(itemFlags_enum.valueToKeys(item->flags())));
properties->append(p);
}
@@ -1695,13 +1632,12 @@ template<class T>
static void loadItemPropsNFlags(QAbstractFormBuilder *abstractFormBuilder, T *item,
const QHash<QString, DomProperty*> &properties)
{
- static const QFormBuilderStrings &strings = QFormBuilderStrings::instance();
static const QMetaEnum itemFlags_enum = metaEnum<QAbstractFormBuilderGadget>("itemFlags");
loadItemProps<T>(abstractFormBuilder, item, properties);
- DomProperty *p;
- if ((p = properties.value(strings.flagsAttribute)) && p->kind() == DomProperty::Set)
+ DomProperty *p = properties.value(QFormBuilderStrings::flagsAttribute);
+ if (p != nullptr && p->kind() == DomProperty::Set)
item->setFlags(enumKeysToValue<Qt::ItemFlags>(itemFlags_enum, p->elementSet().toLatin1()));
}
@@ -1725,10 +1661,10 @@ void QAbstractFormBuilder::saveTreeWidgetExtraInfo(QTreeWidget *treeWidget, DomW
for (const QFormBuilderStrings::TextRoleNName &it : strings.itemTextRoles) {
p = saveText(it.second, treeWidget->headerItem()->data(c, it.first.second));
// Prevent uic 4.4.X from crashing if it cannot find a column text
- if (!p && it.first.first == Qt::EditRole && it.second == QStringLiteral("text")) {
+ if (!p && it.first.first == Qt::EditRole && it.second == "text"_L1) {
DomString *defaultHeader = new DomString;
defaultHeader->setText(QString::number(c + 1));
- defaultHeader->setAttributeNotr(QStringLiteral("true"));
+ defaultHeader->setAttributeNotr(u"true"_s);
p = new DomProperty;
p->setAttributeName(it.second);
p->setElementString(defaultHeader);
@@ -1753,12 +1689,12 @@ void QAbstractFormBuilder::saveTreeWidgetExtraInfo(QTreeWidget *treeWidget, DomW
auto items = ui_widget->elementItem();
- QQueue<QPair<QTreeWidgetItem *, DomItem *> > pendingQueue;
+ QQueue<std::pair<QTreeWidgetItem *, DomItem *> > pendingQueue;
for (int i = 0; i < treeWidget->topLevelItemCount(); i++)
- pendingQueue.enqueue(qMakePair(treeWidget->topLevelItem(i), nullptr));
+ pendingQueue.enqueue(std::make_pair(treeWidget->topLevelItem(i), nullptr));
while (!pendingQueue.isEmpty()) {
- const QPair<QTreeWidgetItem *, DomItem *> pair = pendingQueue.dequeue();
+ const std::pair<QTreeWidgetItem *, DomItem *> pair = pendingQueue.dequeue();
QTreeWidgetItem *item = pair.first;
DomItem *parentDomItem = pair.second;
@@ -1789,7 +1725,7 @@ void QAbstractFormBuilder::saveTreeWidgetExtraInfo(QTreeWidget *treeWidget, DomW
items.append(currentDomItem);
for (int i = 0; i < item->childCount(); i++)
- pendingQueue.enqueue(qMakePair(item->child(i), currentDomItem));
+ pendingQueue.enqueue(std::make_pair(item->child(i), currentDomItem));
}
ui_widget->setElementItem(items);
@@ -1883,7 +1819,7 @@ void QAbstractFormBuilder::saveComboBoxExtraInfo(QComboBox *comboBox, DomWidget
for (int i=0; i < count; ++i) {
// We might encounter items for which both builders return 0 in Designer
// (indicating a custom combo adding items in the constructor). Ignore those.
- DomProperty *textProperty = saveText(QFormBuilderStrings::instance().textAttribute,
+ DomProperty *textProperty = saveText(QFormBuilderStrings::textAttribute,
comboBox->itemData(i, Qt::DisplayPropertyRole));
DomProperty *iconProperty = saveResource(comboBox->itemData(i, Qt::DecorationPropertyRole));
if (textProperty || iconProperty) {
@@ -1914,15 +1850,32 @@ void QAbstractFormBuilder::saveButtonExtraInfo(const QAbstractButton *widget, Do
DomPropertyList attributes = ui_widget->elementAttribute();
DomString *domString = new DomString();
domString->setText(buttonGroup->objectName());
- domString->setAttributeNotr(QStringLiteral("true"));
+ domString->setAttributeNotr(u"true"_s);
DomProperty *domProperty = new DomProperty();
- domProperty->setAttributeName(QLatin1String(buttonGroupPropertyC));
+ domProperty->setAttributeName(buttonGroupPropertyC);
domProperty->setElementString(domString);
attributes += domProperty;
ui_widget->setElementAttribute(attributes);
}
}
+static const QLatin1StringView tableHeaderPrefixes[] = {
+ "horizontalHeader"_L1,
+ "verticalHeader"_L1,
+};
+
+static constexpr QLatin1StringView itemViewHeaderRealPropertyNames[] =
+{
+ // Special handling for qtableview/qtreeview fake header attributes
+ "visible"_L1,
+ "cascadingSectionResizes"_L1,
+ "minimumSectionSize"_L1, // before defaultSectionSize
+ "defaultSectionSize"_L1,
+ "highlightSections"_L1,
+ "showSortIndicator"_L1,
+ "stretchLastSection"_L1
+};
+
/*!
\internal
\since 4.5
@@ -1930,26 +1883,13 @@ void QAbstractFormBuilder::saveButtonExtraInfo(const QAbstractButton *widget, Do
void QAbstractFormBuilder::saveItemViewExtraInfo(const QAbstractItemView *itemView,
DomWidget *ui_widget, DomWidget *)
{
- //
- // Special handling for qtableview/qtreeview fake header attributes
- //
- static const QLatin1String realPropertyNames[] = {
- QLatin1String("visible"),
- QLatin1String("cascadingSectionResizes"),
- QLatin1String("minimumSectionSize"), // before defaultSectionSize
- QLatin1String("defaultSectionSize"),
- QLatin1String("highlightSections"),
- QLatin1String("showSortIndicator"),
- QLatin1String("stretchLastSection"),
- };
-
if (const QTreeView *treeView = qobject_cast<const QTreeView*>(itemView)) {
auto viewProperties = ui_widget->elementAttribute();
const auto &headerProperties = computeProperties(treeView->header());
- for (QString realPropertyName : realPropertyNames) {
- const QString upperPropertyName = realPropertyName.at(0).toUpper()
+ for (const QLatin1StringView realPropertyName : itemViewHeaderRealPropertyNames) {
+ const QString upperPropertyName = QChar(realPropertyName.at(0)).toUpper()
+ realPropertyName.mid(1);
- const QString fakePropertyName = QStringLiteral("header") + upperPropertyName;
+ const QString fakePropertyName = "header"_L1 + upperPropertyName;
for (DomProperty *property : headerProperties) {
if (property->attributeName() == realPropertyName) {
property->setAttributeName(fakePropertyName);
@@ -1959,20 +1899,16 @@ void QAbstractFormBuilder::saveItemViewExtraInfo(const QAbstractItemView *itemVi
}
ui_widget->setElementAttribute(viewProperties);
} else if (const QTableView *tableView = qobject_cast<const QTableView*>(itemView)) {
- static const QStringList headerPrefixes =
- (QStringList() << QStringLiteral("horizontalHeader")
- << QStringLiteral("verticalHeader"));
-
auto viewProperties = ui_widget->elementAttribute();
- for (const QString &headerPrefix : headerPrefixes) {
- const auto &headerProperties = headerPrefix == QStringLiteral("horizontalHeader")
+ for (QLatin1StringView headerPrefix : tableHeaderPrefixes) {
+ const auto &headerProperties = headerPrefix == "horizontalHeader"_L1
? computeProperties(tableView->horizontalHeader())
: computeProperties(tableView->verticalHeader());
- for (QString realPropertyName : realPropertyNames) {
- const QString upperPropertyName = realPropertyName.at(0).toUpper()
+ for (const QLatin1StringView realPropertyName : itemViewHeaderRealPropertyNames) {
+ const QString upperPropertyName = QChar(realPropertyName.at(0)).toUpper()
+ realPropertyName.mid(1);
const QString fakePropertyName = headerPrefix + upperPropertyName;
- for (DomProperty *property : qAsConst(headerProperties)) {
+ for (DomProperty *property : std::as_const(headerProperties)) {
if (property->attributeName() == realPropertyName) {
property->setAttributeName(fakePropertyName);
viewProperties << property;
@@ -2053,8 +1989,6 @@ void QAbstractFormBuilder::saveExtraInfo(QWidget *widget, DomWidget *ui_widget,
void QAbstractFormBuilder::loadListWidgetExtraInfo(DomWidget *ui_widget, QListWidget *listWidget, QWidget *parentWidget)
{
Q_UNUSED(parentWidget);
- const QFormBuilderStrings &strings = QFormBuilderStrings::instance();
-
const auto &elementItem = ui_widget->elementItem();
for (DomItem *ui_item : elementItem) {
const DomPropertyHash properties = propertyMap(ui_item->elementProperty());
@@ -2062,8 +1996,7 @@ void QAbstractFormBuilder::loadListWidgetExtraInfo(DomWidget *ui_widget, QListWi
loadItemPropsNFlags<QListWidgetItem>(this, item, properties);
}
- DomProperty *currentRow = propertyMap(ui_widget->elementProperty()).value(strings.currentRowProperty);
- if (currentRow)
+ if (auto *currentRow = QFBE::propertyByName(ui_widget->elementProperty(), "currentRow"))
listWidget->setCurrentRow(currentRow->elementNumber());
}
@@ -2076,10 +2009,10 @@ void QAbstractFormBuilder::loadTreeWidgetExtraInfo(DomWidget *ui_widget, QTreeWi
const QFormBuilderStrings &strings = QFormBuilderStrings::instance();
const QMetaEnum itemFlags_enum = metaEnum<QAbstractFormBuilderGadget>("itemFlags");
const auto &columns = ui_widget->elementColumn();
- if (columns.count() > 0)
- treeWidget->setColumnCount(columns.count());
+ if (!columns.isEmpty())
+ treeWidget->setColumnCount(columns.size());
- for (int i = 0; i<columns.count(); ++i) {
+ for (qsizetype i = 0, size = columns.size(); i < size; ++i) {
const DomColumn *c = columns.at(i);
const DomPropertyHash properties = propertyMap(c->elementProperty());
@@ -2099,7 +2032,7 @@ void QAbstractFormBuilder::loadTreeWidgetExtraInfo(DomWidget *ui_widget, QTreeWi
treeWidget->headerItem()->setData(i, it.first.second, v);
}
- if ((p = properties.value(strings.iconAttribute))) {
+ if ((p = properties.value(QFormBuilderStrings::iconAttribute))) {
v = resourceBuilder()->loadResource(workingDirectory(), p);
QVariant nativeValue = resourceBuilder()->toNativeValue(v);
treeWidget->headerItem()->setIcon(i, qvariant_cast<QIcon>(nativeValue));
@@ -2107,13 +2040,13 @@ void QAbstractFormBuilder::loadTreeWidgetExtraInfo(DomWidget *ui_widget, QTreeWi
}
}
- QQueue<QPair<DomItem *, QTreeWidgetItem *> > pendingQueue;
+ QQueue<std::pair<DomItem *, QTreeWidgetItem *> > pendingQueue;
const auto &widgetElementItem = ui_widget->elementItem();
for (DomItem *ui_item : widgetElementItem)
- pendingQueue.enqueue(qMakePair(ui_item, nullptr));
+ pendingQueue.enqueue(std::make_pair(ui_item, nullptr));
while (!pendingQueue.isEmpty()) {
- const QPair<DomItem *, QTreeWidgetItem *> pair = pendingQueue.dequeue();
+ const std::pair<DomItem *, QTreeWidgetItem *> pair = pendingQueue.dequeue();
const DomItem *domItem = pair.first;
QTreeWidgetItem *parentItem = pair.second;
@@ -2127,16 +2060,18 @@ void QAbstractFormBuilder::loadTreeWidgetExtraInfo(DomWidget *ui_widget, QTreeWi
const auto &properties = domItem->elementProperty();
int col = -1;
for (DomProperty *property : properties) {
- if (property->attributeName() == strings.flagsAttribute && !property->elementSet().isEmpty()) {
+ if (property->attributeName() == QFormBuilderStrings::flagsAttribute
+ && !property->elementSet().isEmpty()) {
currentItem->setFlags(enumKeysToValue<Qt::ItemFlags>(itemFlags_enum, property->elementSet().toLatin1()));
- } else if (property->attributeName() == strings.textAttribute && property->elementString()) {
+ } else if (property->attributeName() == QFormBuilderStrings::textAttribute
+ && property->elementString()) {
col++;
QVariant textV = textBuilder()->loadText(property);
QVariant nativeValue = textBuilder()->toNativeValue(textV);
currentItem->setText(col, qvariant_cast<QString>(nativeValue));
currentItem->setData(col, Qt::DisplayPropertyRole, textV);
} else if (col >= 0) {
- if (property->attributeName() == strings.iconAttribute) {
+ if (property->attributeName() == QFormBuilderStrings::iconAttribute) {
QVariant v = resourceBuilder()->loadResource(workingDirectory(), property);
if (v.isValid()) {
QVariant nativeValue = resourceBuilder()->toNativeValue(v);
@@ -2150,9 +2085,9 @@ void QAbstractFormBuilder::loadTreeWidgetExtraInfo(DomWidget *ui_widget, QTreeWi
if ((v = toVariant(&QAbstractFormBuilderGadget::staticMetaObject, property)).isValid())
currentItem->setData(col, role, v);
} else {
- QPair<Qt::ItemDataRole, Qt::ItemDataRole> rolePair =
+ std::pair<Qt::ItemDataRole, Qt::ItemDataRole> rolePair =
strings.treeItemTextRoleHash.value(property->attributeName(),
- qMakePair((Qt::ItemDataRole)-1, (Qt::ItemDataRole)-1));
+ std::make_pair((Qt::ItemDataRole)-1, (Qt::ItemDataRole)-1));
if (rolePair.first >= 0) {
QVariant textV = textBuilder()->loadText(property);
QVariant nativeValue = textBuilder()->toNativeValue(textV);
@@ -2166,7 +2101,7 @@ void QAbstractFormBuilder::loadTreeWidgetExtraInfo(DomWidget *ui_widget, QTreeWi
const auto &elementItem = domItem->elementItem();
for (DomItem *childItem : elementItem)
- pendingQueue.enqueue(qMakePair(childItem, currentItem));
+ pendingQueue.enqueue(std::make_pair(childItem, currentItem));
}
}
@@ -2179,9 +2114,9 @@ void QAbstractFormBuilder::loadTableWidgetExtraInfo(DomWidget *ui_widget, QTable
Q_UNUSED(parentWidget);
const auto &columns = ui_widget->elementColumn();
- if (columns.count() > 0)
- tableWidget->setColumnCount(columns.count());
- for (int i = 0; i< columns.count(); i++) {
+ if (!columns.isEmpty())
+ tableWidget->setColumnCount(columns.size());
+ for (qsizetype i = 0, size = columns.size(); i < size; ++i) {
DomColumn *c = columns.at(i);
const DomPropertyHash properties = propertyMap(c->elementProperty());
@@ -2193,9 +2128,9 @@ void QAbstractFormBuilder::loadTableWidgetExtraInfo(DomWidget *ui_widget, QTable
}
const auto &rows = ui_widget->elementRow();
- if (rows.count() > 0)
- tableWidget->setRowCount(rows.count());
- for (int i = 0; i< rows.count(); i++) {
+ if (!rows.isEmpty())
+ tableWidget->setRowCount(rows.size());
+ for (qsizetype i = 0, size = rows.size(); i < size; ++i) {
const DomRow *r = rows.at(i);
const DomPropertyHash properties = propertyMap(r->elementProperty());
@@ -2223,24 +2158,21 @@ void QAbstractFormBuilder::loadTableWidgetExtraInfo(DomWidget *ui_widget, QTable
void QAbstractFormBuilder::loadComboBoxExtraInfo(DomWidget *ui_widget, QComboBox *comboBox, QWidget *parentWidget)
{
Q_UNUSED(parentWidget);
- const QFormBuilderStrings &strings = QFormBuilderStrings::instance();
const auto &elementItem = ui_widget->elementItem();
for (DomItem *ui_item : elementItem) {
- const DomPropertyHash properties = propertyMap(ui_item->elementProperty());
+ const auto &properties = ui_item->elementProperty();
QString text;
QIcon icon;
QVariant textData;
QVariant iconData;
- DomProperty *p = nullptr;
-
- p = properties.value(strings.textAttribute);
+ DomProperty *p = QFBE::propertyByName(properties, QFormBuilderStrings::textAttribute);
if (p && p->elementString()) {
textData = textBuilder()->loadText(p);
text = qvariant_cast<QString>(textBuilder()->toNativeValue(textData));
}
- p = properties.value(strings.iconAttribute);
+ p = QFBE::propertyByName(properties, QFormBuilderStrings::iconAttribute);
if (p) {
iconData = resourceBuilder()->loadResource(workingDirectory(), p);
icon = qvariant_cast<QIcon>(resourceBuilder()->toNativeValue(iconData));
@@ -2251,8 +2183,7 @@ void QAbstractFormBuilder::loadComboBoxExtraInfo(DomWidget *ui_widget, QComboBox
comboBox->setItemData((comboBox->count()-1), textData, Qt::DisplayPropertyRole);
}
- DomProperty *currentIndex = propertyMap(ui_widget->elementProperty()).value(strings.currentIndexProperty);
- if (currentIndex)
+ if (auto *currentIndex = currentIndexProperty(ui_widget->elementProperty()))
comboBox->setCurrentIndex(currentIndex->elementNumber());
}
@@ -2262,7 +2193,7 @@ static QString buttonGroupName(const DomWidget *ui_widget)
const auto &attributes = ui_widget->elementAttribute();
if (attributes.isEmpty())
return QString();
- const QString buttonGroupProperty = QLatin1String(buttonGroupPropertyC);
+ const QString buttonGroupProperty = buttonGroupPropertyC;
for (const DomProperty *p : attributes) {
if (p->attributeName() == buttonGroupProperty)
return p->elementString()->text();
@@ -2284,7 +2215,7 @@ void QAbstractFormBuilder::loadButtonExtraInfo(const DomWidget *ui_widget, QAbst
return;
// Find entry
ButtonGroupHash &buttonGroups = d->buttonGroups();
- ButtonGroupHash::iterator it = buttonGroups.find(groupName);
+ const auto it = buttonGroups.find(groupName);
if (it == buttonGroups.end()) {
#ifdef QFORMINTERNAL_NAMESPACE // Suppress the warning when copying in Designer
uiLibWarning(QCoreApplication::translate("QAbstractFormBuilder", "Invalid QButtonGroup reference '%1' referenced by '%2'.").arg(groupName, button->objectName()));
@@ -2308,26 +2239,13 @@ void QAbstractFormBuilder::loadButtonExtraInfo(const DomWidget *ui_widget, QAbst
void QAbstractFormBuilder::loadItemViewExtraInfo(DomWidget *ui_widget, QAbstractItemView *itemView,
QWidget *)
{
- //
- // Special handling for qtableview/qtreeview fake header attributes
- //
- static const QLatin1String realPropertyNames[] = {
- QLatin1String("visible"),
- QLatin1String("cascadingSectionResizes"),
- QLatin1String("minimumSectionSize"), // before defaultSectionSize
- QLatin1String("defaultSectionSize"),
- QLatin1String("highlightSections"),
- QLatin1String("showSortIndicator"),
- QLatin1String("stretchLastSection"),
- };
-
if (QTreeView *treeView = qobject_cast<QTreeView*>(itemView)) {
const auto &allAttributes = ui_widget->elementAttribute();
QList<DomProperty *> headerProperties;
- for (QString realPropertyName : realPropertyNames) {
- const QString upperPropertyName = realPropertyName.at(0).toUpper()
+ for (QLatin1StringView realPropertyName : itemViewHeaderRealPropertyNames) {
+ const QString upperPropertyName = QChar(realPropertyName.at(0)).toUpper()
+ realPropertyName.mid(1);
- const QString fakePropertyName = QStringLiteral("header") + upperPropertyName;
+ const QString fakePropertyName = "header"_L1 + upperPropertyName;
for (DomProperty *attr : allAttributes) {
if (attr->attributeName() == fakePropertyName) {
attr->setAttributeName(realPropertyName);
@@ -2337,15 +2255,11 @@ void QAbstractFormBuilder::loadItemViewExtraInfo(DomWidget *ui_widget, QAbstract
}
applyProperties(treeView->header(), headerProperties);
} else if (QTableView *tableView = qobject_cast<QTableView*>(itemView)) {
- static const QStringList headerPrefixes =
- (QStringList() << QStringLiteral("horizontalHeader")
- << QStringLiteral("verticalHeader"));
-
const auto &allAttributes = ui_widget->elementAttribute();
- for (const QString &headerPrefix : headerPrefixes) {
+ for (QLatin1StringView headerPrefix : tableHeaderPrefixes) {
QList<DomProperty*> headerProperties;
- for (QString realPropertyName : realPropertyNames) {
- const QString upperPropertyName = realPropertyName.at(0).toUpper()
+ for (QLatin1StringView realPropertyName : itemViewHeaderRealPropertyNames) {
+ const QString upperPropertyName = QChar(realPropertyName.at(0)).toUpper()
+ realPropertyName.mid(1);
const QString fakePropertyName = headerPrefix + upperPropertyName;
for (DomProperty *attr : allAttributes) {
@@ -2355,7 +2269,7 @@ void QAbstractFormBuilder::loadItemViewExtraInfo(DomWidget *ui_widget, QAbstract
}
}
}
- if (headerPrefix == QStringLiteral("horizontalHeader"))
+ if (headerPrefix == "horizontalHeader"_L1)
applyProperties(tableView->horizontalHeader(), headerProperties);
else
applyProperties(tableView->verticalHeader(), headerProperties);
@@ -2368,7 +2282,6 @@ void QAbstractFormBuilder::loadItemViewExtraInfo(DomWidget *ui_widget, QAbstract
*/
void QAbstractFormBuilder::loadExtraInfo(DomWidget *ui_widget, QWidget *widget, QWidget *parentWidget)
{
- const QFormBuilderStrings &strings = QFormBuilderStrings::instance();
if (false) {
#if QT_CONFIG(listwidget)
} else if (QListWidget *listWidget = qobject_cast<QListWidget*>(widget)) {
@@ -2389,23 +2302,19 @@ void QAbstractFormBuilder::loadExtraInfo(DomWidget *ui_widget, QWidget *widget,
#endif
#if QT_CONFIG(tabwidget)
} else if (QTabWidget *tabWidget = qobject_cast<QTabWidget*>(widget)) {
- const DomProperty *currentIndex = propertyMap(ui_widget->elementProperty()).value(strings.currentIndexProperty);
- if (currentIndex)
+ if (auto *currentIndex = currentIndexProperty(ui_widget->elementProperty()))
tabWidget->setCurrentIndex(currentIndex->elementNumber());
#endif
#if QT_CONFIG(stackedwidget)
} else if (QStackedWidget *stackedWidget = qobject_cast<QStackedWidget*>(widget)) {
- const DomProperty *currentIndex = propertyMap(ui_widget->elementProperty()).value(strings.currentIndexProperty);
- if (currentIndex)
+ if (auto *currentIndex = currentIndexProperty(ui_widget->elementProperty()))
stackedWidget->setCurrentIndex(currentIndex->elementNumber());
#endif
#if QT_CONFIG(toolbox)
} else if (QToolBox *toolBox = qobject_cast<QToolBox*>(widget)) {
- const DomProperty *currentIndex = propertyMap(ui_widget->elementProperty()).value(strings.currentIndexProperty);
- if (currentIndex)
+ if (auto *currentIndex = currentIndexProperty(ui_widget->elementProperty()))
toolBox->setCurrentIndex(currentIndex->elementNumber());
- const DomProperty *tabSpacing = propertyMap(ui_widget->elementProperty()).value(strings.tabSpacingProperty);
- if (tabSpacing)
+ if (auto *tabSpacing = QFBE::propertyByName(ui_widget->elementProperty(), "tabSpacing"))
toolBox->layout()->setSpacing(tabSpacing->elementNumber());
#endif
} else if (QAbstractButton *ab = qobject_cast<QAbstractButton *>(widget)) {
@@ -2442,7 +2351,7 @@ void QAbstractFormBuilder::setWorkingDirectory(const QDir &directory)
*/
DomAction *QAbstractFormBuilder::createDom(QAction *action)
{
- if (action->parentWidget() == action->menu() || action->isSeparator())
+ if (action->parent() == action->menu() || action->isSeparator())
return nullptr;
DomAction *ui_action = new DomAction;
@@ -2460,7 +2369,7 @@ DomAction *QAbstractFormBuilder::createDom(QAction *action)
DomButtonGroup *QAbstractFormBuilder::createDom(QButtonGroup *buttonGroup)
{
- if (buttonGroup->buttons().count() == 0) // Empty group left over on form?
+ if (buttonGroup->buttons().isEmpty()) // Empty group left over on form?
return nullptr;
DomButtonGroup *domButtonGroup = new DomButtonGroup;
domButtonGroup->setAttributeName(buttonGroup->objectName());
@@ -2539,7 +2448,7 @@ void QAbstractFormBuilder::setIconProperty(DomProperty &p, const IconPaths &ip)
*/
dpi->setText(ip.first);
- p.setAttributeName(QFormBuilderStrings::instance().iconAttribute);
+ p.setAttributeName(QFormBuilderStrings::iconAttribute);
p.setElementIconSet(dpi);
}
@@ -2565,7 +2474,7 @@ DomProperty *QAbstractFormBuilder::saveResource(const QVariant &v) const
DomProperty *p = resourceBuilder()->saveResource(workingDirectory(), v);
if (p)
- p->setAttributeName(QFormBuilderStrings::instance().iconAttribute);
+ p->setAttributeName(QFormBuilderStrings::iconAttribute);
return p;
}
diff --git a/src/designer/src/lib/uilib/abstractformbuilder.h b/src/designer/src/lib/uilib/abstractformbuilder.h
index 41982edf0..e5073e6fc 100644
--- a/src/designer/src/lib/uilib/abstractformbuilder.h
+++ b/src/designer/src/lib/uilib/abstractformbuilder.h
@@ -1,45 +1,13 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** 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-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef ABSTRACTFORMBUILDER_H
#define ABSTRACTFORMBUILDER_H
+#if 0
+# pragma qt_sync_skip_header_check
+#endif
+
#include "uilib_global.h"
#include <QtCore/qlist.h>
@@ -230,7 +198,7 @@ protected:
// Icon/pixmap stuff
//
// A Pair of icon path/qrc path.
- using IconPaths = QPair<QString, QString>;
+ using IconPaths = std::pair<QString, QString>;
void setIconProperty(DomProperty &, const IconPaths &) const;
void setPixmapProperty(DomProperty &, const IconPaths &) const;
diff --git a/src/designer/src/lib/uilib/formbuilder.cpp b/src/designer/src/lib/uilib/formbuilder.cpp
index 4b5e99c69..ca1c1ee54 100644
--- a/src/designer/src/lib/uilib/formbuilder.cpp
+++ b/src/designer/src/lib/uilib/formbuilder.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** 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-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "formbuilder.h"
#include "formbuilderextra_p.h"
@@ -50,6 +14,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
#ifdef QFORMINTERNAL_NAMESPACE
namespace QFormInternal {
#endif
@@ -122,7 +88,7 @@ QWidget *QFormBuilder::create(DomWidget *ui_widget, QWidget *parentWidget)
// Is this a QLayoutWidget with a margin of 0: Not a known page-based
// container and no method for adding pages registered.
d->setProcessingLayoutWidget(false);
- if (ui_widget->attributeClass() == QFormBuilderStrings::instance().qWidgetClass && !ui_widget->hasAttributeNative()
+ if (ui_widget->attributeClass() == "QWidget"_L1 && !ui_widget->hasAttributeNative()
&& parentWidget
#if QT_CONFIG(mainwindow)
&& !qobject_cast<QMainWindow *>(parentWidget)
@@ -146,7 +112,7 @@ QWidget *QFormBuilder::create(DomWidget *ui_widget, QWidget *parentWidget)
&& !qobject_cast<QDockWidget *>(parentWidget)
#endif
) {
- const QString parentClassName = QLatin1String(parentWidget->metaObject()->className());
+ const QString parentClassName = QLatin1StringView(parentWidget->metaObject()->className());
if (!d->isCustomWidgetContainer(parentClassName))
d->setProcessingLayoutWidget(true);
}
@@ -182,7 +148,7 @@ QWidget *QFormBuilder::createWidget(const QString &widgetName, QWidget *parentWi
// ### special-casing for Line (QFrame) -- fix for 4.2
do {
- if (widgetName == QFormBuilderStrings::instance().lineClass) {
+ if (widgetName == "Line"_L1) {
w = new QFrame(parentWidget);
static_cast<QFrame*>(w)->setFrameStyle(QFrame::HLine | QFrame::Sunken);
break;
@@ -250,7 +216,7 @@ QLayout *QFormBuilder::createLayout(const QString &layoutName, QObject *parent,
#define DECLARE_COMPAT_WIDGET(W, C)
#define DECLARE_LAYOUT(L, C) \
- if (layoutName == QLatin1String(#L)) { \
+ if (layoutName == QLatin1StringView(#L)) { \
Q_ASSERT(l == 0); \
l = parentLayout \
? new L() \
@@ -352,23 +318,9 @@ QLayout *QFormBuilder::create(DomLayout *ui_layout, QLayout *layout, QWidget *pa
bool layoutWidget = d->processingLayoutWidget();
QLayout *l = QAbstractFormBuilder::create(ui_layout, layout, parentWidget);
if (layoutWidget) {
- const QFormBuilderStrings &strings = QFormBuilderStrings::instance();
- int left, top, right, bottom;
- left = top = right = bottom = 0;
- const DomPropertyHash properties = propertyMap(ui_layout->elementProperty());
-
- if (DomProperty *prop = properties.value(strings.leftMarginProperty))
- left = prop->elementNumber();
-
- if (DomProperty *prop = properties.value(strings.topMarginProperty))
- top = prop->elementNumber();
-
- if (DomProperty *prop = properties.value(strings.rightMarginProperty))
- right = prop->elementNumber();
-
- if (DomProperty *prop = properties.value(strings.bottomMarginProperty))
- bottom = prop->elementNumber();
-
+ int left = 0, top = 0, right = 0, bottom = 0;
+ QFormBuilderExtra::getLayoutMargins(ui_layout->elementProperty(),
+ &left, &top, &right, &bottom);
l->setContentsMargins(left, top, right, bottom);
d->setProcessingLayoutWidget(false);
}
@@ -468,7 +420,7 @@ void QFormBuilder::updateCustomWidgets()
d->m_customWidgets.clear();
#if QT_CONFIG(library)
- for (const QString &path : qAsConst(d->m_pluginPaths)) {
+ for (const QString &path : std::as_const(d->m_pluginPaths)) {
const QDir dir(path);
const QStringList candidates = dir.entryList(QDir::Files);
@@ -476,11 +428,7 @@ void QFormBuilder::updateCustomWidgets()
if (!QLibrary::isLibrary(plugin))
continue;
- QString loaderPath = path;
- loaderPath += QLatin1Char('/');
- loaderPath += plugin;
-
- QPluginLoader loader(loaderPath);
+ QPluginLoader loader(path + u'/' + plugin);
if (loader.load())
insertPlugins(loader.instance(), &d->m_customWidgets);
}
@@ -513,8 +461,6 @@ void QFormBuilder::applyProperties(QObject *o, const QList<DomProperty*> &proper
if (properties.isEmpty())
return;
- const QFormBuilderStrings &strings = QFormBuilderStrings::instance();
-
for (DomProperty *p : properties) {
const QVariant v = toVariant(o->metaObject(), p);
if (!v.isValid()) // QTBUG-33130, do not fall for QVariant(QString()).isNull() == true.
@@ -522,11 +468,12 @@ void QFormBuilder::applyProperties(QObject *o, const QList<DomProperty*> &proper
const QString attributeName = p->attributeName();
const bool isWidget = o->isWidgetType();
- if (isWidget && o->parent() == d->parentWidget() && attributeName == strings.geometryProperty) {
+ if (isWidget && o->parent() == d->parentWidget() && attributeName == "geometry"_L1) {
// apply only the size part of a geometry for the root widget
static_cast<QWidget*>(o)->resize(qvariant_cast<QRect>(v).size());
} else if (d->applyPropertyInternally(o, attributeName, v)) {
- } else if (isWidget && !qstrcmp("QFrame", o->metaObject()->className ()) && attributeName == strings.orientationProperty) {
+ } else if (isWidget && qstrcmp("QFrame", o->metaObject()->className()) == 0
+ && attributeName == "orientation"_L1) {
// ### special-casing for Line (QFrame) -- try to fix me
o->setProperty("frameShape", v); // v is of QFrame::Shape enum
} else {
diff --git a/src/designer/src/lib/uilib/formbuilder.h b/src/designer/src/lib/uilib/formbuilder.h
index 79013d221..7b4f8e1fd 100644
--- a/src/designer/src/lib/uilib/formbuilder.h
+++ b/src/designer/src/lib/uilib/formbuilder.h
@@ -1,54 +1,18 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** 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-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef FORMBUILDER_H
#define FORMBUILDER_H
+#if 0
+# pragma qt_class(QFormBuilder)
+# pragma qt_sync_skip_header_check
+#endif
+
#include "uilib_global.h"
#include "abstractformbuilder.h"
QT_BEGIN_NAMESPACE
-#if 0
-// pragma for syncqt, don't remove.
-
-#pragma qt_class(QFormBuilder)
-#endif
class QDesignerCustomWidgetInterface;
diff --git a/src/designer/src/lib/uilib/formbuilderextra.cpp b/src/designer/src/lib/uilib/formbuilderextra.cpp
index 1dbed5348..aae8ec0a0 100644
--- a/src/designer/src/lib/uilib/formbuilderextra.cpp
+++ b/src/designer/src/lib/uilib/formbuilderextra.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** 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-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "formbuilderextra_p.h"
#include "abstractformbuilder.h"
@@ -59,6 +23,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
#ifdef QFORMINTERNAL_NAMESPACE
namespace QFormInternal {
#endif
@@ -80,7 +46,7 @@ QFormBuilderExtra::CustomWidgetData::CustomWidgetData(const DomCustomWidget *dcw
QFormBuilderExtra::QFormBuilderExtra() :
m_defaultMargin(INT_MIN),
m_defaultSpacing(INT_MIN),
- m_language(QStringLiteral("c++"))
+ m_language(u"c++"_s)
{
}
@@ -112,7 +78,6 @@ static inline QString msgXmlError(const QXmlStreamReader &reader)
static bool inline readUiAttributes(QXmlStreamReader &reader, const QString &language,
QString *errorMessage)
{
- const QString uiElement = QStringLiteral("ui");
// Read up to first element
while (!reader.atEnd()) {
switch (reader.readNext()) {
@@ -120,9 +85,9 @@ static bool inline readUiAttributes(QXmlStreamReader &reader, const QString &lan
*errorMessage = msgXmlError(reader);
return false;
case QXmlStreamReader::StartElement:
- if (reader.name().compare(uiElement, Qt::CaseInsensitive) == 0) {
- const QString versionAttribute = QStringLiteral("version");
- const QString languageAttribute = QStringLiteral("language");
+ if (reader.name().compare("ui"_L1, Qt::CaseInsensitive) == 0) {
+ const QString versionAttribute = u"version"_s;
+ const QString languageAttribute = u"language"_s;
const QXmlStreamAttributes attributes = reader.attributes();
if (attributes.hasAttribute(versionAttribute)) {
const QVersionNumber version =
@@ -187,7 +152,7 @@ bool QFormBuilderExtra::applyPropertyInternally(QObject *o, const QString &prope
{
// Store buddies and apply them later on as the widgets might not exist yet.
QLabel *label = qobject_cast<QLabel*>(o);
- if (!label || propertyName != QFormBuilderStrings::instance().buddyProperty)
+ if (label == nullptr || propertyName != "buddy"_L1)
return false;
m_buddies.insert(label, value.toString());
@@ -196,11 +161,7 @@ bool QFormBuilderExtra::applyPropertyInternally(QObject *o, const QString &prope
void QFormBuilderExtra::applyInternalProperties() const
{
- if (m_buddies.isEmpty())
- return;
-
- const BuddyHash::const_iterator cend = m_buddies.constEnd();
- for (BuddyHash::const_iterator it = m_buddies.constBegin(); it != cend; ++it )
+ for (auto it = m_buddies.cbegin(), cend = m_buddies.cend(); it != cend; ++it )
applyBuddy(it.value(), BuddyApplyAll, it.key());
}
@@ -217,10 +178,9 @@ bool QFormBuilderExtra::applyBuddy(const QString &buddyName, BuddyMode applyMode
return false;
}
- const QWidgetList::const_iterator cend = widgets.constEnd();
- for ( QWidgetList::const_iterator it = widgets.constBegin(); it != cend; ++it) {
- if (applyMode == BuddyApplyAll || !(*it)->isHidden()) {
- label->setBuddy(*it);
+ for (auto *w : widgets) {
+ if (applyMode == BuddyApplyAll || !w->isHidden()) {
+ label->setBuddy(w);
return true;
}
}
@@ -254,15 +214,15 @@ void QFormBuilderExtra::storeCustomWidgetData(const QString &className, const Do
QString QFormBuilderExtra::customWidgetBaseClass(const QString &className) const
{
- const QHash<QString, CustomWidgetData>::const_iterator it = m_customWidgetDataHash.constFind(className);
+ const auto it = m_customWidgetDataHash.constFind(className);
if (it != m_customWidgetDataHash.constEnd())
- return it.value().baseClass;
+ return it.value().baseClass;
return QString();
}
QString QFormBuilderExtra::customWidgetAddPageMethod(const QString &className) const
{
- const QHash<QString, CustomWidgetData>::const_iterator it = m_customWidgetDataHash.constFind(className);
+ const auto it = m_customWidgetDataHash.constFind(className);
if (it != m_customWidgetDataHash.constEnd())
return it.value().addPageMethod;
return QString();
@@ -270,7 +230,7 @@ QString QFormBuilderExtra::customWidgetAddPageMethod(const QString &className) c
bool QFormBuilderExtra::isCustomWidgetContainer(const QString &className) const
{
- const QHash<QString, CustomWidgetData>::const_iterator it = m_customWidgetDataHash.constFind(className);
+ const auto it = m_customWidgetDataHash.constFind(className);
if (it != m_customWidgetDataHash.constEnd())
return it.value().isContainer;
return false;
@@ -350,7 +310,7 @@ inline QString perCellPropertyToString(const Layout *l, int count, int (Layout::
QTextStream str(&rc);
for (int i = 0; i < count; i++) {
if (i)
- str << QLatin1Char(',');
+ str << ',';
str << (l->*getter)(i);
}
}
@@ -375,7 +335,7 @@ inline bool parsePerCellProperty(Layout *l, int count, void (Layout::*setter)(in
clearPerCellValue(l, count, setter, defaultValue);
return true;
}
- const auto list = QStringView{s}.split(QLatin1Char(','));
+ const auto list = QStringView{s}.split(u',');
if (list.isEmpty()) {
clearPerCellValue(l, count, setter, defaultValue);
return true;
@@ -403,6 +363,19 @@ static QString msgInvalidStretch(const QString &objectName, const QString &stret
return QCoreApplication::translate("FormBuilder", "Invalid stretch value for '%1': '%2'").arg(objectName, stretch);
}
+void QFormBuilderExtra::getLayoutMargins(const QList<DomProperty*> &properties,
+ int *left, int *top, int *right, int *bottom)
+{
+ if (const auto *p = propertyByName(properties, "leftMargin"))
+ *left = p->elementNumber();
+ if (const auto *p = propertyByName(properties, "topMargin"))
+ *top = p->elementNumber();
+ if (const auto *p = propertyByName(properties, "rightMargin"))
+ *right = p->elementNumber();
+ if (const auto *p = propertyByName(properties, "bottomMargin"))
+ *bottom = p->elementNumber();
+}
+
QString QFormBuilderExtra::boxLayoutStretch(const QBoxLayout *box)
{
return perCellPropertyToString(box, box->count(), &QBoxLayout::stretch);
@@ -501,7 +474,7 @@ void QFormBuilderExtra::clearGridLayoutColumnMinimumWidth(QGridLayout *grid)
clearPerCellValue(grid, grid->columnCount(), &QGridLayout::setColumnMinimumWidth);
}
-void QFormBuilderExtra::setPixmapProperty(DomProperty *p, const QPair<QString, QString> &ip)
+void QFormBuilderExtra::setPixmapProperty(DomProperty *p, const std::pair<QString, QString> &ip)
{
DomResourcePixmap *pix = new DomResourcePixmap;
if (!ip.second.isEmpty())
@@ -509,7 +482,7 @@ void QFormBuilderExtra::setPixmapProperty(DomProperty *p, const QPair<QString, Q
pix->setText(ip.first);
- p->setAttributeName(QFormBuilderStrings::instance().pixmapAttribute);
+ p->setAttributeName("pixmap"_L1);
p->setElementPixmap(pix);
}
@@ -548,14 +521,13 @@ DomColorGroup *QFormBuilderExtra::saveColorGroup(const QPalette &palette,
DomColorGroup *group = new DomColorGroup();
QList<DomColorRole *> colorRoles;
- const uint mask = palette.resolveMask();
- for (int role = QPalette::WindowText; role < QPalette::NColorRoles; ++role) {
- if (mask & (1 << role)) {
- const QBrush &br = palette.brush(colorGroup, QPalette::ColorRole(role));
-
+ for (int r = QPalette::WindowText; r < QPalette::NColorRoles; ++r) {
+ const auto role = static_cast<QPalette::ColorRole>(r);
+ if (palette.isBrushSet(colorGroup, role)) {
+ const QBrush &br = palette.brush(colorGroup, role);
DomColorRole *colorRole = new DomColorRole();
colorRole->setElementBrush(saveBrush(br));
- colorRole->setAttributeRole(QLatin1String(colorRole_enum.valueToKey(role)));
+ colorRole->setAttributeRole(QLatin1StringView(colorRole_enum.valueToKey(role)));
colorRoles.append(colorRole);
}
}
@@ -661,7 +633,7 @@ DomBrush *QFormBuilderExtra::saveBrush(const QBrush &br)
DomBrush *brush = new DomBrush();
const Qt::BrushStyle style = br.style();
- brush->setAttributeBrushStyle(QLatin1String(brushStyle_enum.valueToKey(style)));
+ brush->setAttributeBrushStyle(QLatin1StringView(brushStyle_enum.valueToKey(style)));
if (style == Qt::LinearGradientPattern ||
style == Qt::RadialGradientPattern ||
style == Qt::ConicalGradientPattern) {
@@ -672,9 +644,9 @@ DomBrush *QFormBuilderExtra::saveBrush(const QBrush &br)
DomGradient *gradient = new DomGradient();
const QGradient *gr = br.gradient();
const QGradient::Type type = gr->type();
- gradient->setAttributeType(QLatin1String(gradientType_enum.valueToKey(type)));
- gradient->setAttributeSpread(QLatin1String(gradientSpread_enum.valueToKey(gr->spread())));
- gradient->setAttributeCoordinateMode(QLatin1String(gradientCoordinate_enum.valueToKey(gr->coordinateMode())));
+ gradient->setAttributeType(QLatin1StringView(gradientType_enum.valueToKey(type)));
+ gradient->setAttributeSpread(QLatin1StringView(gradientSpread_enum.valueToKey(gr->spread())));
+ gradient->setAttributeCoordinateMode(QLatin1StringView(gradientCoordinate_enum.valueToKey(gr->coordinateMode())));
QList<DomGradientStop *> stops;
const QGradientStops st = gr->stops();
for (const QGradientStop &pair : st) {
@@ -729,69 +701,35 @@ DomBrush *QFormBuilderExtra::saveBrush(const QBrush &br)
return brush;
}
+DomProperty *QFormBuilderExtra::propertyByName(const QList<DomProperty*> &properties,
+ QAnyStringView needle)
+{
+ auto it = std::find_if(properties.cbegin(), properties.cend(),
+ [needle](const DomProperty *p) {
+ return p->attributeName() == needle; });
+ return it != properties.cend() ? *it : nullptr;
+}
+
// ------------ QFormBuilderStrings
QFormBuilderStrings::QFormBuilderStrings() :
- buddyProperty(QStringLiteral("buddy")),
- cursorProperty(QStringLiteral("cursor")),
- objectNameProperty(QStringLiteral("objectName")),
- trueValue(QStringLiteral("true")),
- falseValue(QStringLiteral("false")),
- horizontalPostFix(QStringLiteral("Horizontal")),
- separator(QStringLiteral("separator")),
- defaultTitle(QStringLiteral("Page")),
- titleAttribute(QStringLiteral("title")),
- labelAttribute(QStringLiteral("label")),
- toolTipAttribute(QStringLiteral("toolTip")),
- whatsThisAttribute(QStringLiteral("whatsThis")),
- flagsAttribute(QStringLiteral("flags")),
- iconAttribute(QStringLiteral("icon")),
- pixmapAttribute(QStringLiteral("pixmap")),
- textAttribute(QStringLiteral("text")),
- currentIndexProperty(QStringLiteral("currentIndex")),
- toolBarAreaAttribute(QStringLiteral("toolBarArea")),
- toolBarBreakAttribute(QStringLiteral("toolBarBreak")),
- dockWidgetAreaAttribute(QStringLiteral("dockWidgetArea")),
- marginProperty(QStringLiteral("margin")),
- spacingProperty(QStringLiteral("spacing")),
- leftMarginProperty(QStringLiteral("leftMargin")),
- topMarginProperty(QStringLiteral("topMargin")),
- rightMarginProperty(QStringLiteral("rightMargin")),
- bottomMarginProperty(QStringLiteral("bottomMargin")),
- horizontalSpacingProperty(QStringLiteral("horizontalSpacing")),
- verticalSpacingProperty(QStringLiteral("verticalSpacing")),
- sizeHintProperty(QStringLiteral("sizeHint")),
- sizeTypeProperty(QStringLiteral("sizeType")),
- orientationProperty(QStringLiteral("orientation")),
- styleSheetProperty(QStringLiteral("styleSheet")),
- qtHorizontal(QStringLiteral("Qt::Horizontal")),
- qtVertical(QStringLiteral("Qt::Vertical")),
- currentRowProperty(QStringLiteral("currentRow")),
- tabSpacingProperty(QStringLiteral("tabSpacing")),
- qWidgetClass(QStringLiteral("QWidget")),
- lineClass(QStringLiteral("Line")),
- geometryProperty(QStringLiteral("geometry")),
- scriptWidgetVariable(QStringLiteral("widget")),
- scriptChildWidgetsVariable(QStringLiteral("childWidgets"))
-{
- itemRoles.append(qMakePair(Qt::FontRole, QString::fromLatin1("font")));
- itemRoles.append(qMakePair(Qt::TextAlignmentRole, QString::fromLatin1("textAlignment")));
- itemRoles.append(qMakePair(Qt::BackgroundRole, QString::fromLatin1("background")));
- itemRoles.append(qMakePair(Qt::ForegroundRole, QString::fromLatin1("foreground")));
- itemRoles.append(qMakePair(Qt::CheckStateRole, QString::fromLatin1("checkState")));
-
- for (const RoleNName &it : qAsConst(itemRoles))
+ itemRoles {
+ {Qt::FontRole, "font"_L1},
+ {Qt::TextAlignmentRole, "textAlignment"_L1},
+ {Qt::BackgroundRole, "background"_L1},
+ {Qt::ForegroundRole, "foreground"_L1},
+ {Qt::CheckStateRole, "checkState"_L1}
+ },
+ itemTextRoles { // This must be first for the loop below
+ { {Qt::EditRole, Qt::DisplayPropertyRole}, textAttribute},
+ { {Qt::ToolTipRole, Qt::ToolTipPropertyRole}, toolTipAttribute},
+ { {Qt::StatusTipRole, Qt::StatusTipPropertyRole}, "statusTip"_L1},
+ { {Qt::WhatsThisRole, Qt::WhatsThisPropertyRole}, whatsThisAttribute}
+ }
+{
+ for (const RoleNName &it : std::as_const(itemRoles))
treeItemRoleHash.insert(it.second, it.first);
- itemTextRoles.append(qMakePair(qMakePair(Qt::EditRole, Qt::DisplayPropertyRole),
- textAttribute)); // This must be first for the loop below
- itemTextRoles.append(qMakePair(qMakePair(Qt::ToolTipRole, Qt::ToolTipPropertyRole),
- toolTipAttribute));
- itemTextRoles.append(qMakePair(qMakePair(Qt::StatusTipRole, Qt::StatusTipPropertyRole),
- QString::fromLatin1("statusTip")));
- itemTextRoles.append(qMakePair(qMakePair(Qt::WhatsThisRole, Qt::WhatsThisPropertyRole),
- whatsThisAttribute));
-
// Note: this skips the first item!
auto it = itemTextRoles.constBegin();
const auto end = itemTextRoles.constEnd();
diff --git a/src/designer/src/lib/uilib/formbuilderextra_p.h b/src/designer/src/lib/uilib/formbuilderextra_p.h
index 94b0c2231..f55945e81 100644
--- a/src/designer/src/lib/uilib/formbuilderextra_p.h
+++ b/src/designer/src/lib/uilib/formbuilderextra_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** 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-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef ABSTRACTFORMBUILDERPRIVATE_H
#define ABSTRACTFORMBUILDERPRIVATE_H
@@ -95,6 +59,8 @@ class QTextBuilder;
class QDESIGNER_UILIB_EXPORT QFormBuilderExtra
{
public:
+ Q_DISABLE_COPY_MOVE(QFormBuilderExtra);
+
QFormBuilderExtra();
~QFormBuilderExtra();
@@ -141,11 +107,14 @@ public:
// --- Hash used in creating button groups on demand. Store a map of name and pair of dom group and real group
void registerButtonGroups(const DomButtonGroups *groups);
- using ButtonGroupEntry = QPair<DomButtonGroup *, QButtonGroup*>;
+ using ButtonGroupEntry = std::pair<DomButtonGroup *, QButtonGroup *>;
using ButtonGroupHash = QHash<QString, ButtonGroupEntry>;
const ButtonGroupHash &buttonGroups() const { return m_buttonGroups; }
ButtonGroupHash &buttonGroups() { return m_buttonGroups; }
+ static void getLayoutMargins(const QList<DomProperty*> &properties,
+ int *left, int *top, int *right, int *bottom);
+
// return stretch as a comma-separated list
static QString boxLayoutStretch(const QBoxLayout*);
// apply stretch
@@ -169,7 +138,7 @@ public:
static bool setGridLayoutColumnMinimumWidth(const QString &, QGridLayout *);
static void clearGridLayoutColumnMinimumWidth(QGridLayout *);
- static void setPixmapProperty(DomProperty *p, const QPair<QString, QString> &ip);
+ static void setPixmapProperty(DomProperty *p, const std::pair<QString, QString> &ip);
static QPalette loadPalette(const DomPalette *dom);
static void setupColorGroup(QPalette *palette, QPalette::ColorGroup colorGroup,
const DomColorGroup *group);
@@ -179,6 +148,9 @@ public:
static QBrush setupBrush(const DomBrush *brush);
static DomBrush *saveBrush(const QBrush &br);
+ static DomProperty *propertyByName(const QList<DomProperty*> &properties,
+ QAnyStringView needle);
+
QStringList m_pluginPaths;
QMap<QString, QDesignerCustomWidgetInterface*> m_customWidgets;
@@ -195,8 +167,7 @@ private:
void clearResourceBuilder();
void clearTextBuilder();
- using BuddyHash = QHash<QLabel*, QString>;
- BuddyHash m_buddies;
+ QHash<QLabel *, QString> m_buddies;
QHash<QString, CustomWidgetData> m_customWidgetDataHash;
@@ -218,58 +189,24 @@ struct QDESIGNER_UILIB_EXPORT QFormBuilderStrings {
static const QFormBuilderStrings &instance();
- const QString buddyProperty;
- const QString cursorProperty;
- const QString objectNameProperty;
- const QString trueValue;
- const QString falseValue;
- const QString horizontalPostFix;
- const QString separator;
- const QString defaultTitle;
- const QString titleAttribute;
- const QString labelAttribute;
- const QString toolTipAttribute;
- const QString whatsThisAttribute;
- const QString flagsAttribute;
- const QString iconAttribute;
- const QString pixmapAttribute;
- const QString textAttribute;
- const QString currentIndexProperty;
- const QString toolBarAreaAttribute;
- const QString toolBarBreakAttribute;
- const QString dockWidgetAreaAttribute;
- const QString marginProperty;
- const QString spacingProperty;
- const QString leftMarginProperty;
- const QString topMarginProperty;
- const QString rightMarginProperty;
- const QString bottomMarginProperty;
- const QString horizontalSpacingProperty;
- const QString verticalSpacingProperty;
- const QString sizeHintProperty;
- const QString sizeTypeProperty;
- const QString orientationProperty;
- const QString styleSheetProperty;
- const QString qtHorizontal;
- const QString qtVertical;
- const QString currentRowProperty;
- const QString tabSpacingProperty;
- const QString qWidgetClass;
- const QString lineClass;
- const QString geometryProperty;
- const QString scriptWidgetVariable;
- const QString scriptChildWidgetsVariable;
-
- using RoleNName = QPair<Qt::ItemDataRole, QString>;
+ static constexpr auto titleAttribute = QLatin1StringView("title");
+ static constexpr auto labelAttribute = QLatin1StringView("label");
+ static constexpr auto toolTipAttribute = QLatin1StringView("toolTip");
+ static constexpr auto whatsThisAttribute = QLatin1StringView("whatsThis");
+ static constexpr auto flagsAttribute = QLatin1StringView("flags");
+ static constexpr auto iconAttribute = QLatin1StringView("icon");
+ static constexpr auto textAttribute = QLatin1StringView("text") ;
+
+ using RoleNName = std::pair<Qt::ItemDataRole, QString>;
QList<RoleNName> itemRoles;
QHash<QString, Qt::ItemDataRole> treeItemRoleHash;
// first.first is primary role, first.second is shadow role.
// Shadow is used for either the translation source or the designer
// representation of the string value.
- using TextRoleNName = QPair<QPair<Qt::ItemDataRole, Qt::ItemDataRole>, QString>;
+ using TextRoleNName = std::pair<std::pair<Qt::ItemDataRole, Qt::ItemDataRole>, QString>;
QList<TextRoleNName> itemTextRoles;
- QHash<QString, QPair<Qt::ItemDataRole, Qt::ItemDataRole> > treeItemTextRoleHash;
+ QHash<QString, std::pair<Qt::ItemDataRole, Qt::ItemDataRole> > treeItemTextRoleHash;
};
#ifdef QFORMINTERNAL_NAMESPACE
}
diff --git a/src/designer/src/lib/uilib/properties.cpp b/src/designer/src/lib/uilib/properties.cpp
index d7ba8cef1..872e8975f 100644
--- a/src/designer/src/lib/uilib/properties.cpp
+++ b/src/designer/src/lib/uilib/properties.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** 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-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "properties_p.h"
#include "ui4_p.h"
@@ -53,21 +17,17 @@
#include <QtWidgets/qframe.h>
#include <QtWidgets/qabstractscrollarea.h>
+#include <limits>
+
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
#ifdef QFORMINTERNAL_NAMESPACE
namespace QFormInternal
{
#endif
-static inline void fixEnum(QString &s)
-{
- int qualifierIndex = s.lastIndexOf(QLatin1Char(':'));
- if (qualifierIndex == -1)
- qualifierIndex = s.lastIndexOf(QLatin1Char('.'));
- if (qualifierIndex != -1)
- s.remove(0, qualifierIndex + 1);
-}
// Convert complex DOM types with the help of QAbstractFormBuilder
QVariant domPropertyToVariant(QAbstractFormBuilder *afb,const QMetaObject *meta,const DomProperty *p)
{
@@ -107,29 +67,44 @@ QVariant domPropertyToVariant(QAbstractFormBuilder *afb,const QMetaObject *meta,
const QMetaEnum e = meta->property(index).enumerator();
Q_ASSERT(e.isFlag() == true);
- return QVariant(e.keysToValue(p->elementSet().toUtf8()));
+ bool ok{};
+ QVariant result(e.keysToValue(p->elementSet().toUtf8().constData(), &ok));
+ if (!ok) {
+ uiLibWarning(QCoreApplication::translate("QFormBuilder",
+ "The value \"%1\" of the set-type property %2 could not be read.").
+ arg(p->attributeName(), p->elementSet()));
+ return {};
+ }
+ return result;
}
case DomProperty::Enum: {
const QByteArray pname = p->attributeName().toUtf8();
const int index = meta->indexOfProperty(pname);
- QString enumValue = p->elementEnum();
+ const auto &enumValue = p->elementEnum();
// Triggers in case of objects in Designer like Spacer/Line for which properties
// are serialized using language introspection. On preview, however, these objects are
// emulated by hacks in the formbuilder (size policy/orientation)
- fixEnum(enumValue);
if (index == -1) {
// ### special-casing for Line (QFrame) -- fix for 4.2. Jambi hack for enumerations
if (!qstrcmp(meta->className(), "QFrame")
&& (pname == QByteArray("orientation"))) {
- return QVariant(enumValue == QFormBuilderStrings::instance().horizontalPostFix ? QFrame::HLine : QFrame::VLine);
+ return QVariant(enumValue.endsWith("Horizontal"_L1) ? QFrame::HLine : QFrame::VLine);
}
uiLibWarning(QCoreApplication::translate("QFormBuilder", "The enumeration-type property %1 could not be read.").arg(p->attributeName()));
return QVariant();
}
const QMetaEnum e = meta->property(index).enumerator();
- return QVariant(e.keyToValue(enumValue.toUtf8()));
+ bool ok{};
+ QVariant result(e.keyToValue(enumValue.toUtf8().constData(), &ok));
+ if (!ok) {
+ uiLibWarning(QCoreApplication::translate("QFormBuilder",
+ "The value \"%1\" of the enum-type property %2 could not be read.").
+ arg(p->attributeName(), enumValue));
+ return {};
+ }
+ return result;
}
case DomProperty::Brush:
return QVariant::fromValue(afb->setupBrush(p->elementBrush()));
@@ -145,13 +120,22 @@ QVariant domPropertyToVariant(QAbstractFormBuilder *afb,const QMetaObject *meta,
return domPropertyToVariant(p);
}
+// Convert a legacy Qt 4 integer font weight to the closes enumeration value
+
+static inline QMetaEnum fontWeightMetaEnum()
+{
+ const QMetaEnum result = metaEnum<QAbstractFormBuilderGadget>("fontWeight");
+ Q_ASSERT(result.isValid());
+ return result;
+}
+
// Convert simple DOM types
QVariant domPropertyToVariant(const DomProperty *p)
{
// requires non-const virtual nameToIcon, etc.
switch(p->kind()) {
case DomProperty::Bool:
- return QVariant(p->elementBool() == QFormBuilderStrings::instance().trueValue);
+ return QVariant(p->elementBool() == "true"_L1);
case DomProperty::Cstring:
return QVariant(p->elementCstring().toUtf8());
@@ -230,8 +214,6 @@ QVariant domPropertyToVariant(const DomProperty *p)
f.setPointSize(font->elementPointSize());
if (font->hasElementItalic())
f.setItalic(font->elementItalic());
- if (font->hasElementBold())
- f.setBold(font->elementBold());
if (font->hasElementUnderline())
f.setUnderline(font->elementUnderline());
if (font->hasElementStrikeOut())
@@ -244,6 +226,19 @@ QVariant domPropertyToVariant(const DomProperty *p)
f.setStyleStrategy(enumKeyOfObjectToValue<QAbstractFormBuilderGadget, QFont::StyleStrategy>("styleStrategy",
font->elementStyleStrategy().toLatin1().constData()));
}
+ if (font->hasElementHintingPreference()) {
+ f.setHintingPreference(enumKeyOfObjectToValue<QAbstractFormBuilderGadget, QFont::HintingPreference>("hintingPreference",
+ font->elementHintingPreference().toLatin1().constData()));
+ }
+
+ if (font->hasElementFontWeight()) {
+ f.setWeight(enumKeyOfObjectToValue<QAbstractFormBuilderGadget, QFont::Weight>(
+ "fontWeight",
+ font->elementFontWeight().toLatin1().constData()));
+ } else if (font->hasElementBold()) {
+ f.setBold(font->elementBold());
+ }
+
return QVariant::fromValue(f);
}
@@ -282,8 +277,8 @@ QVariant domPropertyToVariant(const DomProperty *p)
const DomLocale *locale = p->elementLocale();
return QVariant::fromValue(QLocale(enumKeyOfObjectToValue<QAbstractFormBuilderGadget, QLocale::Language>("language",
locale->attributeLanguage().toLatin1().constData()),
- enumKeyOfObjectToValue<QAbstractFormBuilderGadget, QLocale::Country>("country",
- locale->attributeCountry().toLatin1().constData())));
+ enumKeyOfObjectToValue<QAbstractFormBuilderGadget, QLocale::Territory>("country",
+ locale->attributeCountry().toLatin1().constData())));
}
case DomProperty::SizePolicy: {
const DomSizePolicy *sizep = p->elementSizePolicy();
@@ -330,7 +325,7 @@ static bool applySimpleProperty(const QVariant &v, bool translateString, DomProp
DomString *str = new DomString();
str->setText(v.toString());
if (!translateString)
- str->setAttributeNotr(QStringLiteral("true"));
+ str->setAttributeNotr(u"true"_s);
dom_prop->setElementString(str);
}
return true;
@@ -360,7 +355,7 @@ static bool applySimpleProperty(const QVariant &v, bool translateString, DomProp
return true;
case QMetaType::Bool:
- dom_prop->setElementBool(v.toBool() ? QFormBuilderStrings::instance().trueValue : QFormBuilderStrings::instance().falseValue);
+ dom_prop->setElementBool(v.toBool() ? "true"_L1 : "false"_L1);
return true;
case QMetaType::QChar: {
@@ -446,9 +441,23 @@ static bool applySimpleProperty(const QVariant &v, bool translateString, DomProp
DomFont *fnt = new DomFont();
const QFont font = qvariant_cast<QFont>(v);
const uint mask = font.resolveMask();
- if (mask & QFont::WeightResolved)
- fnt->setElementBold(font.bold());
- if (mask & QFont::FamilyResolved)
+ if (mask & QFont::WeightResolved) {
+ switch (font.weight()) {
+ case QFont::Normal:
+ fnt->setElementBold(false);
+ break;
+ case QFont::Bold:
+ fnt->setElementBold(true);
+ break;
+ default: {
+ const QMetaEnum me = fontWeightMetaEnum();
+ const QString ws = QLatin1StringView(me.valueToKey(font.weight()));
+ fnt->setElementFontWeight(ws);
+ }
+ break;
+ }
+ }
+ if ((mask & (QFont::FamilyResolved | QFont::FamiliesResolved)) != 0)
fnt->setElementFamily(font.family());
if (mask & QFont::StyleResolved)
fnt->setElementItalic(font.italic());
@@ -462,8 +471,13 @@ static bool applySimpleProperty(const QVariant &v, bool translateString, DomProp
fnt->setElementKerning(font.kerning());
if (mask & QFont::StyleStrategyResolved) {
const QMetaEnum styleStrategy_enum = metaEnum<QAbstractFormBuilderGadget>("styleStrategy");
- fnt->setElementStyleStrategy(QLatin1String(styleStrategy_enum.valueToKey(font.styleStrategy())));
+ fnt->setElementStyleStrategy(QLatin1StringView(styleStrategy_enum.valueToKey(font.styleStrategy())));
+ }
+ if (mask & QFont::HintingPreferenceResolved) {
+ const QMetaEnum hintingPreference_enum = metaEnum<QAbstractFormBuilderGadget>("hintingPreference");
+ fnt->setElementHintingPreference(QLatin1StringView(hintingPreference_enum.valueToKey(font.hintingPreference())));
}
+
dom_prop->setElementFont(fnt);
}
return true;
@@ -471,7 +485,7 @@ static bool applySimpleProperty(const QVariant &v, bool translateString, DomProp
#if QT_CONFIG(cursor)
case QMetaType::QCursor: {
const QMetaEnum cursorShape_enum = metaEnum<QAbstractFormBuilderGadget>("cursorShape");
- dom_prop->setElementCursorShape(QLatin1String(cursorShape_enum.valueToKey(qvariant_cast<QCursor>(v).shape())));
+ dom_prop->setElementCursorShape(QLatin1StringView(cursorShape_enum.valueToKey(qvariant_cast<QCursor>(v).shape())));
}
return true;
#endif
@@ -488,10 +502,10 @@ static bool applySimpleProperty(const QVariant &v, bool translateString, DomProp
const QLocale locale = qvariant_cast<QLocale>(v);
const QMetaEnum language_enum = metaEnum<QAbstractFormBuilderGadget>("language");
- const QMetaEnum country_enum = metaEnum<QAbstractFormBuilderGadget>("country");
+ const QMetaEnum territory_enum = metaEnum<QAbstractFormBuilderGadget>("country");
- dom->setAttributeLanguage(QLatin1String(language_enum.valueToKey(locale.language())));
- dom->setAttributeCountry(QLatin1String(country_enum.valueToKey(locale.country())));
+ dom->setAttributeLanguage(QLatin1StringView(language_enum.valueToKey(locale.language())));
+ dom->setAttributeCountry(QLatin1StringView(territory_enum.valueToKey(locale.territory())));
dom_prop->setElementLocale(dom);
}
@@ -506,8 +520,8 @@ static bool applySimpleProperty(const QVariant &v, bool translateString, DomProp
const QMetaEnum sizeType_enum = metaEnum<QAbstractFormBuilderGadget>("sizeType");
- dom->setAttributeHSizeType(QLatin1String(sizeType_enum.valueToKey(sizePolicy.horizontalPolicy())));
- dom->setAttributeVSizeType(QLatin1String(sizeType_enum.valueToKey(sizePolicy.verticalPolicy())));
+ dom->setAttributeHSizeType(QLatin1StringView(sizeType_enum.valueToKey(sizePolicy.horizontalPolicy())));
+ dom->setAttributeVSizeType(QLatin1StringView(sizeType_enum.valueToKey(sizePolicy.verticalPolicy())));
dom_prop->setElementSizePolicy(dom);
}
@@ -580,7 +594,7 @@ static bool applySimpleProperty(const QVariant &v, bool translateString, DomProp
static QString msgCannotWriteProperty(const QString &pname, const QVariant &v)
{
return QCoreApplication::translate("QFormBuilder", "The property %1 could not be written. The type %2 is not supported yet.").
- arg(pname).arg(QLatin1String(v.typeName()));
+ arg(pname).arg(QLatin1StringView(v.typeName()));
}
@@ -595,10 +609,9 @@ static bool isOfType(const QMetaObject *what, const QMetaObject *type)
static bool isTranslatable(const QString &pname, const QVariant &v, const QMetaObject *meta)
{
- const QFormBuilderStrings &strings = QFormBuilderStrings::instance();
- if (pname == strings.objectNameProperty)
+ if (pname == "objectName"_L1)
return false;
- if (pname == strings.styleSheetProperty && v.metaType().id() == QMetaType::QString
+ if (pname == "styleSheet"_L1 && v.metaType().id() == QMetaType::QString
&& isOfType(meta, &QWidget::staticMetaObject)) {
return false;
}
@@ -610,8 +623,6 @@ static bool isTranslatable(const QString &pname, const QVariant &v, const QMetaO
DomProperty *variantToDomProperty(QAbstractFormBuilder *afb, const QMetaObject *meta,
const QString &pname, const QVariant &v)
{
- const QFormBuilderStrings &strings = QFormBuilderStrings::instance();
-
DomProperty *dom_prop = new DomProperty();
dom_prop->setAttributeName(pname);
@@ -626,8 +637,11 @@ DomProperty *variantToDomProperty(QAbstractFormBuilder *afb, const QMetaObject *
dom_prop->setElementEnum(QString::fromLatin1(e.valueToKey(v.toInt())));
return dom_prop;
}
- if (!meta_property.hasStdCppSet() || (isOfType(meta, &QAbstractScrollArea::staticMetaObject) && pname == strings.cursorProperty))
+ if (!meta_property.hasStdCppSet()
+ || (isOfType(meta, &QAbstractScrollArea::staticMetaObject)
+ && pname == "cursor"_L1)) {
dom_prop->setAttributeStdset(0);
+ }
}
// Try simple properties
diff --git a/src/designer/src/lib/uilib/properties_p.h b/src/designer/src/lib/uilib/properties_p.h
index 7fa8e052f..3b94253a4 100644
--- a/src/designer/src/lib/uilib/properties_p.h
+++ b/src/designer/src/lib/uilib/properties_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** 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-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
//
// W A R N I N G
@@ -91,6 +55,8 @@ class QAbstractFormBuilderGadget: public QWidget
Q_PROPERTY(QPalette::ColorRole colorRole READ fakeColorRole)
Q_PROPERTY(QPalette::ColorGroup colorGroup READ fakeColorGroup)
Q_PROPERTY(QFont::StyleStrategy styleStrategy READ fakeStyleStrategy)
+ Q_PROPERTY(QFont::HintingPreference hintingPreference READ fakeHintingPreference)
+ Q_PROPERTY(QFont::Weight fontWeight READ fakeFontWeight)
Q_PROPERTY(Qt::CursorShape cursorShape READ fakeCursorShape)
Q_PROPERTY(Qt::BrushStyle brushStyle READ fakeBrushStyle)
Q_PROPERTY(Qt::ToolBarArea toolBarArea READ fakeToolBarArea)
@@ -107,6 +73,8 @@ public:
QPalette::ColorGroup fakeColorGroup() const { Q_ASSERT(0); return static_cast<QPalette::ColorGroup>(0); }
QPalette::ColorRole fakeColorRole() const { Q_ASSERT(0); return static_cast<QPalette::ColorRole>(0); }
QFont::StyleStrategy fakeStyleStrategy() const { Q_ASSERT(0); return QFont::PreferDefault; }
+ QFont::HintingPreference fakeHintingPreference() const { Q_ASSERT(0); return QFont::PreferDefaultHinting; }
+ QFont::Weight fakeFontWeight() const { Q_ASSERT(0); return QFont::Weight::Normal; }
Qt::CursorShape fakeCursorShape() const { Q_ASSERT(0); return Qt::ArrowCursor; }
Qt::BrushStyle fakeBrushStyle() const { Q_ASSERT(0); return Qt::NoBrush; }
Qt::ToolBarArea fakeToolBarArea() const { Q_ASSERT(0); return Qt::NoToolBarArea; }
@@ -128,7 +96,7 @@ inline EnumType enumKeyToValue(const QMetaEnum &metaEnum,const char *key, const
if (val == -1) {
uiLibWarning(QCoreApplication::translate("QFormBuilder", "The enumeration-value '%1' is invalid. The default value '%2' will be used instead.")
- .arg(QString::fromUtf8(key)).arg(QString::fromUtf8(metaEnum.key(0))));
+ .arg(QString::fromUtf8(key), QString::fromUtf8(metaEnum.key(0))));
val = metaEnum.value(0);
}
return static_cast<EnumType>(val);
diff --git a/src/designer/src/lib/uilib/resourcebuilder.cpp b/src/designer/src/lib/uilib/resourcebuilder.cpp
index eb9cb2728..5afd25439 100644
--- a/src/designer/src/lib/uilib/resourcebuilder.cpp
+++ b/src/designer/src/lib/uilib/resourcebuilder.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** 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-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "resourcebuilder_p.h"
#include "ui4_p.h"
@@ -48,6 +12,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
#ifdef QFORMINTERNAL_NAMESPACE
namespace QFormInternal {
#endif
@@ -61,7 +27,8 @@ QResourceBuilder::~QResourceBuilder() = default;
int QResourceBuilder::iconStateFlags(const DomResourceIcon *dpi)
{
int rc = 0;
- if (dpi->hasElementNormalOff())
+ // Fix form files broken by QTBUG-115465
+ if (dpi->hasElementNormalOff() && dpi->elementNormalOff()->text() != "."_L1)
rc |= NormalOff;
if (dpi->hasElementNormalOn())
rc |= NormalOn;
@@ -92,11 +59,17 @@ QVariant QResourceBuilder::loadResource(const QDir &workingDirectory, const DomP
const DomResourceIcon *dpi = property->elementIconSet();
if (!dpi->attributeTheme().isEmpty()) {
const QString theme = dpi->attributeTheme();
+ const qsizetype themeEnum = theme.at(0).isUpper()
+ ? themeIconNames().indexOf(theme) : -1;
+ if (themeEnum != -1) {
+ const auto themeEnumE = static_cast<QIcon::ThemeIcon>(themeEnum);
+ return QVariant::fromValue(QIcon::fromTheme(themeEnumE));
+ }
const bool known = QIcon::hasThemeIcon(theme);
if (themeDebug)
qDebug("Theme %s known %d", qPrintable(theme), known);
if (known)
- return QVariant::fromValue(QIcon::fromTheme(dpi->attributeTheme()));
+ return QVariant::fromValue(QIcon::fromTheme(theme));
} // non-empty theme
if (const int flags = iconStateFlags(dpi)) { // new, post 4.4 format
QIcon icon;
@@ -165,6 +138,96 @@ bool QResourceBuilder::isResourceType(const QVariant &value) const
return false;
}
+const QStringList &QResourceBuilder::themeIconNames()
+{
+ static const QStringList result = {
+ "AddressBookNew"_L1, "ApplicationExit"_L1, "AppointmentNew"_L1,
+ "CallStart"_L1, "CallStop"_L1, "ContactNew"_L1,
+ "DocumentNew"_L1, "DocumentOpen"_L1, "DocumentOpenRecent"_L1,
+ "DocumentPageSetup"_L1, "DocumentPrint"_L1, "DocumentPrintPreview"_L1,
+ "DocumentProperties"_L1, "DocumentRevert"_L1, "DocumentSave"_L1,
+ "DocumentSaveAs"_L1, "DocumentSend"_L1,
+ "EditClear"_L1, "EditCopy"_L1, "EditCut"_L1, "EditDelete"_L1,
+ "EditFind"_L1, "EditPaste"_L1,
+ "EditRedo"_L1, "EditSelectAll"_L1, "EditUndo"_L1,
+ "FolderNew"_L1,
+ "FormatIndentLess"_L1, "FormatIndentMore"_L1,
+ "FormatJustifyCenter"_L1, "FormatJustifyFill"_L1,
+ "FormatJustifyLeft"_L1, "FormatJustifyRight"_L1,
+ "FormatTextDirectionLtr"_L1, "FormatTextDirectionRtl"_L1,
+ "FormatTextBold"_L1, "FormatTextItalic"_L1,
+ "FormatTextUnderline"_L1, "FormatTextStrikethrough"_L1,
+ "GoDown"_L1, "GoHome"_L1, "GoNext"_L1, "GoPrevious"_L1, "GoUp"_L1,
+ "HelpAbout"_L1, "HelpFaq"_L1,
+ "InsertImage"_L1, "InsertLink"_L1, "InsertText"_L1,
+ "ListAdd"_L1, "ListRemove"_L1,
+ "MailForward"_L1, "MailMarkImportant"_L1, "MailMarkRead"_L1, "MailMarkUnread"_L1,
+ "MailMessageNew"_L1, "MailReplyAll"_L1, "MailReplySender"_L1,
+ "MailSend"_L1,
+ "MediaEject"_L1, "MediaPlaybackPause"_L1, "MediaPlaybackStart"_L1,
+ "MediaPlaybackStop"_L1, "MediaRecord"_L1, "MediaSeekBackward"_L1,
+ "MediaSeekForward"_L1, "MediaSkipBackward"_L1,
+ "MediaSkipForward"_L1,
+ "ObjectRotateLeft"_L1, "ObjectRotateRight"_L1,
+ "ProcessStop"_L1,
+ "SystemLockScreen"_L1, "SystemLogOut"_L1,
+ "SystemSearch"_L1, "SystemReboot"_L1, "SystemShutdown"_L1,
+ "ToolsCheckSpelling"_L1,
+ "ViewFullscreen"_L1, "ViewRefresh"_L1, "ViewRestore"_L1,
+ "WindowClose"_L1, "WindowNew"_L1,
+ "ZoomFitBest"_L1, "ZoomIn"_L1, "ZoomOut"_L1,
+ "AudioCard"_L1, "AudioInputMicrophone"_L1,
+ "Battery"_L1,
+ "CameraPhoto"_L1, "CameraVideo"_L1, "CameraWeb"_L1,
+ "Computer"_L1, "DriveHarddisk"_L1, "DriveOptical"_L1,
+ "InputGaming"_L1, "InputKeyboard"_L1, "InputMouse"_L1,
+ "InputTablet"_L1,
+ "MediaFlash"_L1, "MediaOptical"_L1,
+ "MediaTape"_L1,
+ "MultimediaPlayer"_L1,
+ "NetworkWired"_L1, "NetworkWireless"_L1,
+ "Phone"_L1, "Printer"_L1, "Scanner"_L1, "VideoDisplay"_L1,
+ "AppointmentMissed"_L1, "AppointmentSoon"_L1,
+ "AudioVolumeHigh"_L1, "AudioVolumeLow"_L1, "AudioVolumeMedium"_L1,
+ "AudioVolumeMuted"_L1,
+ "BatteryCaution"_L1, "BatteryLow"_L1,
+ "DialogError"_L1, "DialogInformation"_L1, "DialogPassword"_L1,
+ "DialogQuestion"_L1, "DialogWarning"_L1,
+ "FolderDragAccept"_L1, "FolderOpen"_L1, "FolderVisiting"_L1,
+ "ImageLoading"_L1, "ImageMissing"_L1,
+ "MailAttachment"_L1, "MailUnread"_L1, "MailRead"_L1,
+ "MailReplied"_L1,
+ "MediaPlaylistRepeat"_L1, "MediaPlaylistShuffle"_L1,
+ "NetworkOffline"_L1,
+ "PrinterPrinting"_L1,
+ "SecurityHigh"_L1, "SecurityLow"_L1,
+ "SoftwareUpdateAvailable"_L1, "SoftwareUpdateUrgent"_L1,
+ "SyncError"_L1, "SyncSynchronizing"_L1,
+ "UserAvailable"_L1,
+ "UserOffline"_L1,
+ "WeatherClear"_L1, "WeatherClearNight"_L1, "WeatherFewClouds"_L1,
+ "WeatherFewCloudsNight"_L1, "WeatherFog"_L1, "WeatherShowers"_L1,
+ "WeatherSnow"_L1, "WeatherStorm"_L1
+ };
+
+ return result;
+};
+
+int QResourceBuilder::themeIconIndex(QStringView name)
+{
+ const auto lastQual = name.lastIndexOf("::"_L1);
+ const auto result = lastQual != -1
+ ? themeIconNames().indexOf(name.sliced(lastQual + 2))
+ : themeIconNames().indexOf(name);
+ return int(result);
+}
+
+QString QResourceBuilder::fullyQualifiedThemeIconName(int i)
+{
+ return i >= 0 && i < themeIconNames().size()
+ ? "QIcon::ThemeIcon::"_L1 + themeIconNames().at(i) : QString{};
+}
+
#ifdef QFORMINTERNAL_NAMESPACE
} // namespace QFormInternal
#endif
diff --git a/src/designer/src/lib/uilib/resourcebuilder_p.h b/src/designer/src/lib/uilib/resourcebuilder_p.h
index a5fb6b37c..721a92541 100644
--- a/src/designer/src/lib/uilib/resourcebuilder_p.h
+++ b/src/designer/src/lib/uilib/resourcebuilder_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** 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-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef RESOURCEBUILDER_H
#define RESOURCEBUILDER_H
@@ -79,6 +43,11 @@ public:
QResourceBuilder();
virtual ~QResourceBuilder();
+ // Icon names matching QIcon::ThemeIcon
+ static const QStringList &themeIconNames();
+ static int themeIconIndex(QStringView name);
+ static QString fullyQualifiedThemeIconName(int i);
+
virtual QVariant loadResource(const QDir &workingDirectory, const DomProperty *property) const;
virtual QVariant toNativeValue(const QVariant &value) const;
diff --git a/src/designer/src/lib/uilib/textbuilder.cpp b/src/designer/src/lib/uilib/textbuilder.cpp
index 96d453ee3..b2bd20008 100644
--- a/src/designer/src/lib/uilib/textbuilder.cpp
+++ b/src/designer/src/lib/uilib/textbuilder.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** 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-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "textbuilder_p.h"
#include "ui4_p.h"
diff --git a/src/designer/src/lib/uilib/textbuilder_p.h b/src/designer/src/lib/uilib/textbuilder_p.h
index 7944c6f7e..541c4583d 100644
--- a/src/designer/src/lib/uilib/textbuilder_p.h
+++ b/src/designer/src/lib/uilib/textbuilder_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** 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-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef TEXTBUILDER_H
#define TEXTBUILDER_H
diff --git a/src/designer/src/lib/uilib/ui4.cpp b/src/designer/src/lib/uilib/ui4.cpp
index 1a3738ce1..fcff2ea9d 100644
--- a/src/designer/src/lib/uilib/ui4.cpp
+++ b/src/designer/src/lib/uilib/ui4.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 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:LGPL$
-** 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 Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** 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-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT!
@@ -43,6 +7,9 @@
QT_BEGIN_NAMESPACE
+
+using namespace Qt::StringLiterals;
+
#ifdef QFORMINTERNAL_NAMESPACE
using namespace QFormInternal;
#endif
@@ -71,133 +38,133 @@ void DomUI::read(QXmlStreamReader &reader)
const QXmlStreamAttributes &attributes = reader.attributes();
for (const QXmlStreamAttribute &attribute : attributes) {
const auto name = attribute.name();
- if (name == QLatin1String("version")) {
+ if (name == u"version"_s) {
setAttributeVersion(attribute.value().toString());
continue;
}
- if (name == QLatin1String("language")) {
+ if (name == u"language"_s) {
setAttributeLanguage(attribute.value().toString());
continue;
}
- if (name == QLatin1String("displayname")) {
+ if (name == u"displayname"_s) {
setAttributeDisplayname(attribute.value().toString());
continue;
}
- if (name == QLatin1String("idbasedtr")) {
- setAttributeIdbasedtr(attribute.value() == QLatin1String("true"));
+ if (name == u"idbasedtr"_s) {
+ setAttributeIdbasedtr(attribute.value() == u"true"_s);
continue;
}
- if (name == QLatin1String("connectslotsbyname")) {
- setAttributeConnectslotsbyname(attribute.value() == QLatin1String("true"));
+ if (name == u"connectslotsbyname"_s) {
+ setAttributeConnectslotsbyname(attribute.value() == u"true"_s);
continue;
}
- if (name == QLatin1String("stdsetdef")) {
+ if (name == u"stdsetdef"_s) {
setAttributeStdsetdef(attribute.value().toInt());
continue;
}
- if (name == QLatin1String("stdSetDef")) {
+ if (name == u"stdSetDef"_s) {
setAttributeStdSetDef(attribute.value().toInt());
continue;
}
- reader.raiseError(QLatin1String("Unexpected attribute ") + name);
+ reader.raiseError("Unexpected attribute "_L1 + name);
}
while (!reader.hasError()) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- if (!tag.compare(QLatin1String("author"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"author"_s, Qt::CaseInsensitive)) {
setElementAuthor(reader.readElementText());
continue;
}
- if (!tag.compare(QLatin1String("comment"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"comment"_s, Qt::CaseInsensitive)) {
setElementComment(reader.readElementText());
continue;
}
- if (!tag.compare(QLatin1String("exportmacro"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"exportmacro"_s, Qt::CaseInsensitive)) {
setElementExportMacro(reader.readElementText());
continue;
}
- if (!tag.compare(QLatin1String("class"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"class"_s, Qt::CaseInsensitive)) {
setElementClass(reader.readElementText());
continue;
}
- if (!tag.compare(QLatin1String("widget"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"widget"_s, Qt::CaseInsensitive)) {
auto *v = new DomWidget();
v->read(reader);
setElementWidget(v);
continue;
}
- if (!tag.compare(QLatin1String("layoutdefault"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"layoutdefault"_s, Qt::CaseInsensitive)) {
auto *v = new DomLayoutDefault();
v->read(reader);
setElementLayoutDefault(v);
continue;
}
- if (!tag.compare(QLatin1String("layoutfunction"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"layoutfunction"_s, Qt::CaseInsensitive)) {
auto *v = new DomLayoutFunction();
v->read(reader);
setElementLayoutFunction(v);
continue;
}
- if (!tag.compare(QLatin1String("pixmapfunction"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"pixmapfunction"_s, Qt::CaseInsensitive)) {
setElementPixmapFunction(reader.readElementText());
continue;
}
- if (!tag.compare(QLatin1String("customwidgets"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"customwidgets"_s, Qt::CaseInsensitive)) {
auto *v = new DomCustomWidgets();
v->read(reader);
setElementCustomWidgets(v);
continue;
}
- if (!tag.compare(QLatin1String("tabstops"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"tabstops"_s, Qt::CaseInsensitive)) {
auto *v = new DomTabStops();
v->read(reader);
setElementTabStops(v);
continue;
}
- if (!tag.compare(QLatin1String("images"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"images"_s, Qt::CaseInsensitive)) {
qWarning("Omitting deprecated element <images>.");
reader.skipCurrentElement();
continue;
}
- if (!tag.compare(QLatin1String("includes"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"includes"_s, Qt::CaseInsensitive)) {
auto *v = new DomIncludes();
v->read(reader);
setElementIncludes(v);
continue;
}
- if (!tag.compare(QLatin1String("resources"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"resources"_s, Qt::CaseInsensitive)) {
auto *v = new DomResources();
v->read(reader);
setElementResources(v);
continue;
}
- if (!tag.compare(QLatin1String("connections"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"connections"_s, Qt::CaseInsensitive)) {
auto *v = new DomConnections();
v->read(reader);
setElementConnections(v);
continue;
}
- if (!tag.compare(QLatin1String("designerdata"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"designerdata"_s, Qt::CaseInsensitive)) {
auto *v = new DomDesignerData();
v->read(reader);
setElementDesignerdata(v);
continue;
}
- if (!tag.compare(QLatin1String("slots"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"slots"_s, Qt::CaseInsensitive)) {
auto *v = new DomSlots();
v->read(reader);
setElementSlots(v);
continue;
}
- if (!tag.compare(QLatin1String("buttongroups"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"buttongroups"_s, Qt::CaseInsensitive)) {
auto *v = new DomButtonGroups();
v->read(reader);
setElementButtonGroups(v);
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -213,73 +180,73 @@ void DomUI::write(QXmlStreamWriter &writer, const QString &tagName) const
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("ui") : tagName.toLower());
if (hasAttributeVersion())
- writer.writeAttribute(QStringLiteral("version"), attributeVersion());
+ writer.writeAttribute(u"version"_s, attributeVersion());
if (hasAttributeLanguage())
- writer.writeAttribute(QStringLiteral("language"), attributeLanguage());
+ writer.writeAttribute(u"language"_s, attributeLanguage());
if (hasAttributeDisplayname())
- writer.writeAttribute(QStringLiteral("displayname"), attributeDisplayname());
+ writer.writeAttribute(u"displayname"_s, attributeDisplayname());
if (hasAttributeIdbasedtr())
- writer.writeAttribute(QStringLiteral("idbasedtr"), (attributeIdbasedtr() ? QLatin1String("true") : QLatin1String("false")));
+ writer.writeAttribute(u"idbasedtr"_s, (attributeIdbasedtr() ? u"true"_s : u"false"_s));
if (hasAttributeConnectslotsbyname())
- writer.writeAttribute(QStringLiteral("connectslotsbyname"), (attributeConnectslotsbyname() ? QLatin1String("true") : QLatin1String("false")));
+ writer.writeAttribute(u"connectslotsbyname"_s, (attributeConnectslotsbyname() ? u"true"_s : u"false"_s));
if (hasAttributeStdsetdef())
- writer.writeAttribute(QStringLiteral("stdsetdef"), QString::number(attributeStdsetdef()));
+ writer.writeAttribute(u"stdsetdef"_s, QString::number(attributeStdsetdef()));
if (hasAttributeStdSetDef())
- writer.writeAttribute(QStringLiteral("stdsetdef"), QString::number(attributeStdSetDef()));
+ writer.writeAttribute(u"stdsetdef"_s, QString::number(attributeStdSetDef()));
if (m_children & Author)
- writer.writeTextElement(QStringLiteral("author"), m_author);
+ writer.writeTextElement(u"author"_s, m_author);
if (m_children & Comment)
- writer.writeTextElement(QStringLiteral("comment"), m_comment);
+ writer.writeTextElement(u"comment"_s, m_comment);
if (m_children & ExportMacro)
- writer.writeTextElement(QStringLiteral("exportmacro"), m_exportMacro);
+ writer.writeTextElement(u"exportmacro"_s, m_exportMacro);
if (m_children & Class)
- writer.writeTextElement(QStringLiteral("class"), m_class);
+ writer.writeTextElement(u"class"_s, m_class);
if (m_children & Widget)
- m_widget->write(writer, QStringLiteral("widget"));
+ m_widget->write(writer, u"widget"_s);
if (m_children & LayoutDefault)
- m_layoutDefault->write(writer, QStringLiteral("layoutdefault"));
+ m_layoutDefault->write(writer, u"layoutdefault"_s);
if (m_children & LayoutFunction)
- m_layoutFunction->write(writer, QStringLiteral("layoutfunction"));
+ m_layoutFunction->write(writer, u"layoutfunction"_s);
if (m_children & PixmapFunction)
- writer.writeTextElement(QStringLiteral("pixmapfunction"), m_pixmapFunction);
+ writer.writeTextElement(u"pixmapfunction"_s, m_pixmapFunction);
if (m_children & CustomWidgets)
- m_customWidgets->write(writer, QStringLiteral("customwidgets"));
+ m_customWidgets->write(writer, u"customwidgets"_s);
if (m_children & TabStops)
- m_tabStops->write(writer, QStringLiteral("tabstops"));
+ m_tabStops->write(writer, u"tabstops"_s);
if (m_children & Includes)
- m_includes->write(writer, QStringLiteral("includes"));
+ m_includes->write(writer, u"includes"_s);
if (m_children & Resources)
- m_resources->write(writer, QStringLiteral("resources"));
+ m_resources->write(writer, u"resources"_s);
if (m_children & Connections)
- m_connections->write(writer, QStringLiteral("connections"));
+ m_connections->write(writer, u"connections"_s);
if (m_children & Designerdata)
- m_designerdata->write(writer, QStringLiteral("designerdata"));
+ m_designerdata->write(writer, u"designerdata"_s);
if (m_children & Slots)
- m_slots->write(writer, QStringLiteral("slots"));
+ m_slots->write(writer, u"slots"_s);
if (m_children & ButtonGroups)
- m_buttonGroups->write(writer, QStringLiteral("buttongroups"));
+ m_buttonGroups->write(writer, u"buttongroups"_s);
writer.writeEndElement();
}
@@ -593,13 +560,13 @@ void DomIncludes::read(QXmlStreamReader &reader)
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- if (!tag.compare(QLatin1String("include"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"include"_s, Qt::CaseInsensitive)) {
auto *v = new DomInclude();
v->read(reader);
m_include.append(v);
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -615,7 +582,7 @@ void DomIncludes::write(QXmlStreamWriter &writer, const QString &tagName) const
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("includes") : tagName.toLower());
for (DomInclude *v : m_include)
- v->write(writer, QStringLiteral("include"));
+ v->write(writer, u"include"_s);
writer.writeEndElement();
}
@@ -633,22 +600,22 @@ void DomInclude::read(QXmlStreamReader &reader)
const QXmlStreamAttributes &attributes = reader.attributes();
for (const QXmlStreamAttribute &attribute : attributes) {
const auto name = attribute.name();
- if (name == QLatin1String("location")) {
+ if (name == u"location"_s) {
setAttributeLocation(attribute.value().toString());
continue;
}
- if (name == QLatin1String("impldecl")) {
+ if (name == u"impldecl"_s) {
setAttributeImpldecl(attribute.value().toString());
continue;
}
- reader.raiseError(QLatin1String("Unexpected attribute ") + name);
+ reader.raiseError("Unexpected attribute "_L1 + name);
}
while (!reader.hasError()) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -668,10 +635,10 @@ void DomInclude::write(QXmlStreamWriter &writer, const QString &tagName) const
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("include") : tagName.toLower());
if (hasAttributeLocation())
- writer.writeAttribute(QStringLiteral("location"), attributeLocation());
+ writer.writeAttribute(u"location"_s, attributeLocation());
if (hasAttributeImpldecl())
- writer.writeAttribute(QStringLiteral("impldecl"), attributeImpldecl());
+ writer.writeAttribute(u"impldecl"_s, attributeImpldecl());
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
@@ -690,24 +657,24 @@ void DomResources::read(QXmlStreamReader &reader)
const QXmlStreamAttributes &attributes = reader.attributes();
for (const QXmlStreamAttribute &attribute : attributes) {
const auto name = attribute.name();
- if (name == QLatin1String("name")) {
+ if (name == u"name"_s) {
setAttributeName(attribute.value().toString());
continue;
}
- reader.raiseError(QLatin1String("Unexpected attribute ") + name);
+ reader.raiseError("Unexpected attribute "_L1 + name);
}
while (!reader.hasError()) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- if (!tag.compare(QLatin1String("include"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"include"_s, Qt::CaseInsensitive)) {
auto *v = new DomResource();
v->read(reader);
m_include.append(v);
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -723,10 +690,10 @@ void DomResources::write(QXmlStreamWriter &writer, const QString &tagName) const
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("resources") : tagName.toLower());
if (hasAttributeName())
- writer.writeAttribute(QStringLiteral("name"), attributeName());
+ writer.writeAttribute(u"name"_s, attributeName());
for (DomResource *v : m_include)
- v->write(writer, QStringLiteral("include"));
+ v->write(writer, u"include"_s);
writer.writeEndElement();
}
@@ -744,18 +711,18 @@ void DomResource::read(QXmlStreamReader &reader)
const QXmlStreamAttributes &attributes = reader.attributes();
for (const QXmlStreamAttribute &attribute : attributes) {
const auto name = attribute.name();
- if (name == QLatin1String("location")) {
+ if (name == u"location"_s) {
setAttributeLocation(attribute.value().toString());
continue;
}
- reader.raiseError(QLatin1String("Unexpected attribute ") + name);
+ reader.raiseError("Unexpected attribute "_L1 + name);
}
while (!reader.hasError()) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -771,7 +738,7 @@ void DomResource::write(QXmlStreamWriter &writer, const QString &tagName) const
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("resource") : tagName.toLower());
if (hasAttributeLocation())
- writer.writeAttribute(QStringLiteral("location"), attributeLocation());
+ writer.writeAttribute(u"location"_s, attributeLocation());
writer.writeEndElement();
}
@@ -793,42 +760,42 @@ void DomActionGroup::read(QXmlStreamReader &reader)
const QXmlStreamAttributes &attributes = reader.attributes();
for (const QXmlStreamAttribute &attribute : attributes) {
const auto name = attribute.name();
- if (name == QLatin1String("name")) {
+ if (name == u"name"_s) {
setAttributeName(attribute.value().toString());
continue;
}
- reader.raiseError(QLatin1String("Unexpected attribute ") + name);
+ reader.raiseError("Unexpected attribute "_L1 + name);
}
while (!reader.hasError()) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- if (!tag.compare(QLatin1String("action"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"action"_s, Qt::CaseInsensitive)) {
auto *v = new DomAction();
v->read(reader);
m_action.append(v);
continue;
}
- if (!tag.compare(QLatin1String("actiongroup"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"actiongroup"_s, Qt::CaseInsensitive)) {
auto *v = new DomActionGroup();
v->read(reader);
m_actionGroup.append(v);
continue;
}
- if (!tag.compare(QLatin1String("property"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"property"_s, Qt::CaseInsensitive)) {
auto *v = new DomProperty();
v->read(reader);
m_property.append(v);
continue;
}
- if (!tag.compare(QLatin1String("attribute"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"attribute"_s, Qt::CaseInsensitive)) {
auto *v = new DomProperty();
v->read(reader);
m_attribute.append(v);
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -844,19 +811,19 @@ void DomActionGroup::write(QXmlStreamWriter &writer, const QString &tagName) con
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("actiongroup") : tagName.toLower());
if (hasAttributeName())
- writer.writeAttribute(QStringLiteral("name"), attributeName());
+ writer.writeAttribute(u"name"_s, attributeName());
for (DomAction *v : m_action)
- v->write(writer, QStringLiteral("action"));
+ v->write(writer, u"action"_s);
for (DomActionGroup *v : m_actionGroup)
- v->write(writer, QStringLiteral("actiongroup"));
+ v->write(writer, u"actiongroup"_s);
for (DomProperty *v : m_property)
- v->write(writer, QStringLiteral("property"));
+ v->write(writer, u"property"_s);
for (DomProperty *v : m_attribute)
- v->write(writer, QStringLiteral("attribute"));
+ v->write(writer, u"attribute"_s);
writer.writeEndElement();
}
@@ -898,34 +865,34 @@ void DomAction::read(QXmlStreamReader &reader)
const QXmlStreamAttributes &attributes = reader.attributes();
for (const QXmlStreamAttribute &attribute : attributes) {
const auto name = attribute.name();
- if (name == QLatin1String("name")) {
+ if (name == u"name"_s) {
setAttributeName(attribute.value().toString());
continue;
}
- if (name == QLatin1String("menu")) {
+ if (name == u"menu"_s) {
setAttributeMenu(attribute.value().toString());
continue;
}
- reader.raiseError(QLatin1String("Unexpected attribute ") + name);
+ reader.raiseError("Unexpected attribute "_L1 + name);
}
while (!reader.hasError()) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- if (!tag.compare(QLatin1String("property"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"property"_s, Qt::CaseInsensitive)) {
auto *v = new DomProperty();
v->read(reader);
m_property.append(v);
continue;
}
- if (!tag.compare(QLatin1String("attribute"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"attribute"_s, Qt::CaseInsensitive)) {
auto *v = new DomProperty();
v->read(reader);
m_attribute.append(v);
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -941,16 +908,16 @@ void DomAction::write(QXmlStreamWriter &writer, const QString &tagName) const
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("action") : tagName.toLower());
if (hasAttributeName())
- writer.writeAttribute(QStringLiteral("name"), attributeName());
+ writer.writeAttribute(u"name"_s, attributeName());
if (hasAttributeMenu())
- writer.writeAttribute(QStringLiteral("menu"), attributeMenu());
+ writer.writeAttribute(u"menu"_s, attributeMenu());
for (DomProperty *v : m_property)
- v->write(writer, QStringLiteral("property"));
+ v->write(writer, u"property"_s);
for (DomProperty *v : m_attribute)
- v->write(writer, QStringLiteral("attribute"));
+ v->write(writer, u"attribute"_s);
writer.writeEndElement();
}
@@ -974,18 +941,18 @@ void DomActionRef::read(QXmlStreamReader &reader)
const QXmlStreamAttributes &attributes = reader.attributes();
for (const QXmlStreamAttribute &attribute : attributes) {
const auto name = attribute.name();
- if (name == QLatin1String("name")) {
+ if (name == u"name"_s) {
setAttributeName(attribute.value().toString());
continue;
}
- reader.raiseError(QLatin1String("Unexpected attribute ") + name);
+ reader.raiseError("Unexpected attribute "_L1 + name);
}
while (!reader.hasError()) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -1001,7 +968,7 @@ void DomActionRef::write(QXmlStreamWriter &writer, const QString &tagName) const
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("actionref") : tagName.toLower());
if (hasAttributeName())
- writer.writeAttribute(QStringLiteral("name"), attributeName());
+ writer.writeAttribute(u"name"_s, attributeName());
writer.writeEndElement();
}
@@ -1019,30 +986,30 @@ void DomButtonGroup::read(QXmlStreamReader &reader)
const QXmlStreamAttributes &attributes = reader.attributes();
for (const QXmlStreamAttribute &attribute : attributes) {
const auto name = attribute.name();
- if (name == QLatin1String("name")) {
+ if (name == u"name"_s) {
setAttributeName(attribute.value().toString());
continue;
}
- reader.raiseError(QLatin1String("Unexpected attribute ") + name);
+ reader.raiseError("Unexpected attribute "_L1 + name);
}
while (!reader.hasError()) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- if (!tag.compare(QLatin1String("property"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"property"_s, Qt::CaseInsensitive)) {
auto *v = new DomProperty();
v->read(reader);
m_property.append(v);
continue;
}
- if (!tag.compare(QLatin1String("attribute"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"attribute"_s, Qt::CaseInsensitive)) {
auto *v = new DomProperty();
v->read(reader);
m_attribute.append(v);
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -1058,13 +1025,13 @@ void DomButtonGroup::write(QXmlStreamWriter &writer, const QString &tagName) con
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("buttongroup") : tagName.toLower());
if (hasAttributeName())
- writer.writeAttribute(QStringLiteral("name"), attributeName());
+ writer.writeAttribute(u"name"_s, attributeName());
for (DomProperty *v : m_property)
- v->write(writer, QStringLiteral("property"));
+ v->write(writer, u"property"_s);
for (DomProperty *v : m_attribute)
- v->write(writer, QStringLiteral("attribute"));
+ v->write(writer, u"attribute"_s);
writer.writeEndElement();
}
@@ -1093,13 +1060,13 @@ void DomButtonGroups::read(QXmlStreamReader &reader)
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- if (!tag.compare(QLatin1String("buttongroup"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"buttongroup"_s, Qt::CaseInsensitive)) {
auto *v = new DomButtonGroup();
v->read(reader);
m_buttonGroup.append(v);
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -1115,7 +1082,7 @@ void DomButtonGroups::write(QXmlStreamWriter &writer, const QString &tagName) co
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("buttongroups") : tagName.toLower());
for (DomButtonGroup *v : m_buttonGroup)
- v->write(writer, QStringLiteral("buttongroup"));
+ v->write(writer, u"buttongroup"_s);
writer.writeEndElement();
}
@@ -1138,13 +1105,13 @@ void DomCustomWidgets::read(QXmlStreamReader &reader)
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- if (!tag.compare(QLatin1String("customwidget"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"customwidget"_s, Qt::CaseInsensitive)) {
auto *v = new DomCustomWidget();
v->read(reader);
m_customWidget.append(v);
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -1160,7 +1127,7 @@ void DomCustomWidgets::write(QXmlStreamWriter &writer, const QString &tagName) c
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("customwidgets") : tagName.toLower());
for (DomCustomWidget *v : m_customWidget)
- v->write(writer, QStringLiteral("customwidget"));
+ v->write(writer, u"customwidget"_s);
writer.writeEndElement();
}
@@ -1178,18 +1145,18 @@ void DomHeader::read(QXmlStreamReader &reader)
const QXmlStreamAttributes &attributes = reader.attributes();
for (const QXmlStreamAttribute &attribute : attributes) {
const auto name = attribute.name();
- if (name == QLatin1String("location")) {
+ if (name == u"location"_s) {
setAttributeLocation(attribute.value().toString());
continue;
}
- reader.raiseError(QLatin1String("Unexpected attribute ") + name);
+ reader.raiseError("Unexpected attribute "_L1 + name);
}
while (!reader.hasError()) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -1209,7 +1176,7 @@ void DomHeader::write(QXmlStreamWriter &writer, const QString &tagName) const
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("header") : tagName.toLower());
if (hasAttributeLocation())
- writer.writeAttribute(QStringLiteral("location"), attributeLocation());
+ writer.writeAttribute(u"location"_s, attributeLocation());
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
@@ -1231,66 +1198,66 @@ void DomCustomWidget::read(QXmlStreamReader &reader)
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- if (!tag.compare(QLatin1String("class"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"class"_s, Qt::CaseInsensitive)) {
setElementClass(reader.readElementText());
continue;
}
- if (!tag.compare(QLatin1String("extends"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"extends"_s, Qt::CaseInsensitive)) {
setElementExtends(reader.readElementText());
continue;
}
- if (!tag.compare(QLatin1String("header"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"header"_s, Qt::CaseInsensitive)) {
auto *v = new DomHeader();
v->read(reader);
setElementHeader(v);
continue;
}
- if (!tag.compare(QLatin1String("sizehint"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"sizehint"_s, Qt::CaseInsensitive)) {
auto *v = new DomSize();
v->read(reader);
setElementSizeHint(v);
continue;
}
- if (!tag.compare(QLatin1String("addpagemethod"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"addpagemethod"_s, Qt::CaseInsensitive)) {
setElementAddPageMethod(reader.readElementText());
continue;
}
- if (!tag.compare(QLatin1String("container"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"container"_s, Qt::CaseInsensitive)) {
setElementContainer(reader.readElementText().toInt());
continue;
}
- if (!tag.compare(QLatin1String("sizepolicy"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"sizepolicy"_s, Qt::CaseInsensitive)) {
qWarning("Omitting deprecated element <sizepolicy>.");
reader.skipCurrentElement();
continue;
}
- if (!tag.compare(QLatin1String("pixmap"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"pixmap"_s, Qt::CaseInsensitive)) {
setElementPixmap(reader.readElementText());
continue;
}
- if (!tag.compare(QLatin1String("script"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"script"_s, Qt::CaseInsensitive)) {
qWarning("Omitting deprecated element <script>.");
reader.skipCurrentElement();
continue;
}
- if (!tag.compare(QLatin1String("properties"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"properties"_s, Qt::CaseInsensitive)) {
qWarning("Omitting deprecated element <properties>.");
reader.skipCurrentElement();
continue;
}
- if (!tag.compare(QLatin1String("slots"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"slots"_s, Qt::CaseInsensitive)) {
auto *v = new DomSlots();
v->read(reader);
setElementSlots(v);
continue;
}
- if (!tag.compare(QLatin1String("propertyspecifications"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"propertyspecifications"_s, Qt::CaseInsensitive)) {
auto *v = new DomPropertySpecifications();
v->read(reader);
setElementPropertyspecifications(v);
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -1306,31 +1273,31 @@ void DomCustomWidget::write(QXmlStreamWriter &writer, const QString &tagName) co
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("customwidget") : tagName.toLower());
if (m_children & Class)
- writer.writeTextElement(QStringLiteral("class"), m_class);
+ writer.writeTextElement(u"class"_s, m_class);
if (m_children & Extends)
- writer.writeTextElement(QStringLiteral("extends"), m_extends);
+ writer.writeTextElement(u"extends"_s, m_extends);
if (m_children & Header)
- m_header->write(writer, QStringLiteral("header"));
+ m_header->write(writer, u"header"_s);
if (m_children & SizeHint)
- m_sizeHint->write(writer, QStringLiteral("sizehint"));
+ m_sizeHint->write(writer, u"sizehint"_s);
if (m_children & AddPageMethod)
- writer.writeTextElement(QStringLiteral("addpagemethod"), m_addPageMethod);
+ writer.writeTextElement(u"addpagemethod"_s, m_addPageMethod);
if (m_children & Container)
- writer.writeTextElement(QStringLiteral("container"), QString::number(m_container));
+ writer.writeTextElement(u"container"_s, QString::number(m_container));
if (m_children & Pixmap)
- writer.writeTextElement(QStringLiteral("pixmap"), m_pixmap);
+ writer.writeTextElement(u"pixmap"_s, m_pixmap);
if (m_children & Slots)
- m_slots->write(writer, QStringLiteral("slots"));
+ m_slots->write(writer, u"slots"_s);
if (m_children & Propertyspecifications)
- m_propertyspecifications->write(writer, QStringLiteral("propertyspecifications"));
+ m_propertyspecifications->write(writer, u"propertyspecifications"_s);
writer.writeEndElement();
}
@@ -1485,22 +1452,22 @@ void DomLayoutDefault::read(QXmlStreamReader &reader)
const QXmlStreamAttributes &attributes = reader.attributes();
for (const QXmlStreamAttribute &attribute : attributes) {
const auto name = attribute.name();
- if (name == QLatin1String("spacing")) {
+ if (name == u"spacing"_s) {
setAttributeSpacing(attribute.value().toInt());
continue;
}
- if (name == QLatin1String("margin")) {
+ if (name == u"margin"_s) {
setAttributeMargin(attribute.value().toInt());
continue;
}
- reader.raiseError(QLatin1String("Unexpected attribute ") + name);
+ reader.raiseError("Unexpected attribute "_L1 + name);
}
while (!reader.hasError()) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -1516,10 +1483,10 @@ void DomLayoutDefault::write(QXmlStreamWriter &writer, const QString &tagName) c
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("layoutdefault") : tagName.toLower());
if (hasAttributeSpacing())
- writer.writeAttribute(QStringLiteral("spacing"), QString::number(attributeSpacing()));
+ writer.writeAttribute(u"spacing"_s, QString::number(attributeSpacing()));
if (hasAttributeMargin())
- writer.writeAttribute(QStringLiteral("margin"), QString::number(attributeMargin()));
+ writer.writeAttribute(u"margin"_s, QString::number(attributeMargin()));
writer.writeEndElement();
}
@@ -1531,22 +1498,22 @@ void DomLayoutFunction::read(QXmlStreamReader &reader)
const QXmlStreamAttributes &attributes = reader.attributes();
for (const QXmlStreamAttribute &attribute : attributes) {
const auto name = attribute.name();
- if (name == QLatin1String("spacing")) {
+ if (name == u"spacing"_s) {
setAttributeSpacing(attribute.value().toString());
continue;
}
- if (name == QLatin1String("margin")) {
+ if (name == u"margin"_s) {
setAttributeMargin(attribute.value().toString());
continue;
}
- reader.raiseError(QLatin1String("Unexpected attribute ") + name);
+ reader.raiseError("Unexpected attribute "_L1 + name);
}
while (!reader.hasError()) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -1562,10 +1529,10 @@ void DomLayoutFunction::write(QXmlStreamWriter &writer, const QString &tagName)
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("layoutfunction") : tagName.toLower());
if (hasAttributeSpacing())
- writer.writeAttribute(QStringLiteral("spacing"), attributeSpacing());
+ writer.writeAttribute(u"spacing"_s, attributeSpacing());
if (hasAttributeMargin())
- writer.writeAttribute(QStringLiteral("margin"), attributeMargin());
+ writer.writeAttribute(u"margin"_s, attributeMargin());
writer.writeEndElement();
}
@@ -1581,11 +1548,11 @@ void DomTabStops::read(QXmlStreamReader &reader)
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- if (!tag.compare(QLatin1String("tabstop"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"tabstop"_s, Qt::CaseInsensitive)) {
m_tabStop.append(reader.readElementText());
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -1601,7 +1568,7 @@ void DomTabStops::write(QXmlStreamWriter &writer, const QString &tagName) const
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("tabstops") : tagName.toLower());
for (const QString &v : m_tabStop)
- writer.writeTextElement(QStringLiteral("tabstop"), v);
+ writer.writeTextElement(u"tabstop"_s, v);
writer.writeEndElement();
}
@@ -1627,60 +1594,60 @@ void DomLayout::read(QXmlStreamReader &reader)
const QXmlStreamAttributes &attributes = reader.attributes();
for (const QXmlStreamAttribute &attribute : attributes) {
const auto name = attribute.name();
- if (name == QLatin1String("class")) {
+ if (name == u"class"_s) {
setAttributeClass(attribute.value().toString());
continue;
}
- if (name == QLatin1String("name")) {
+ if (name == u"name"_s) {
setAttributeName(attribute.value().toString());
continue;
}
- if (name == QLatin1String("stretch")) {
+ if (name == u"stretch"_s) {
setAttributeStretch(attribute.value().toString());
continue;
}
- if (name == QLatin1String("rowstretch")) {
+ if (name == u"rowstretch"_s) {
setAttributeRowStretch(attribute.value().toString());
continue;
}
- if (name == QLatin1String("columnstretch")) {
+ if (name == u"columnstretch"_s) {
setAttributeColumnStretch(attribute.value().toString());
continue;
}
- if (name == QLatin1String("rowminimumheight")) {
+ if (name == u"rowminimumheight"_s) {
setAttributeRowMinimumHeight(attribute.value().toString());
continue;
}
- if (name == QLatin1String("columnminimumwidth")) {
+ if (name == u"columnminimumwidth"_s) {
setAttributeColumnMinimumWidth(attribute.value().toString());
continue;
}
- reader.raiseError(QLatin1String("Unexpected attribute ") + name);
+ reader.raiseError("Unexpected attribute "_L1 + name);
}
while (!reader.hasError()) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- if (!tag.compare(QLatin1String("property"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"property"_s, Qt::CaseInsensitive)) {
auto *v = new DomProperty();
v->read(reader);
m_property.append(v);
continue;
}
- if (!tag.compare(QLatin1String("attribute"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"attribute"_s, Qt::CaseInsensitive)) {
auto *v = new DomProperty();
v->read(reader);
m_attribute.append(v);
continue;
}
- if (!tag.compare(QLatin1String("item"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"item"_s, Qt::CaseInsensitive)) {
auto *v = new DomLayoutItem();
v->read(reader);
m_item.append(v);
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -1696,34 +1663,34 @@ void DomLayout::write(QXmlStreamWriter &writer, const QString &tagName) const
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("layout") : tagName.toLower());
if (hasAttributeClass())
- writer.writeAttribute(QStringLiteral("class"), attributeClass());
+ writer.writeAttribute(u"class"_s, attributeClass());
if (hasAttributeName())
- writer.writeAttribute(QStringLiteral("name"), attributeName());
+ writer.writeAttribute(u"name"_s, attributeName());
if (hasAttributeStretch())
- writer.writeAttribute(QStringLiteral("stretch"), attributeStretch());
+ writer.writeAttribute(u"stretch"_s, attributeStretch());
if (hasAttributeRowStretch())
- writer.writeAttribute(QStringLiteral("rowstretch"), attributeRowStretch());
+ writer.writeAttribute(u"rowstretch"_s, attributeRowStretch());
if (hasAttributeColumnStretch())
- writer.writeAttribute(QStringLiteral("columnstretch"), attributeColumnStretch());
+ writer.writeAttribute(u"columnstretch"_s, attributeColumnStretch());
if (hasAttributeRowMinimumHeight())
- writer.writeAttribute(QStringLiteral("rowminimumheight"), attributeRowMinimumHeight());
+ writer.writeAttribute(u"rowminimumheight"_s, attributeRowMinimumHeight());
if (hasAttributeColumnMinimumWidth())
- writer.writeAttribute(QStringLiteral("columnminimumwidth"), attributeColumnMinimumWidth());
+ writer.writeAttribute(u"columnminimumwidth"_s, attributeColumnMinimumWidth());
for (DomProperty *v : m_property)
- v->write(writer, QStringLiteral("property"));
+ v->write(writer, u"property"_s);
for (DomProperty *v : m_attribute)
- v->write(writer, QStringLiteral("attribute"));
+ v->write(writer, u"attribute"_s);
for (DomLayoutItem *v : m_item)
- v->write(writer, QStringLiteral("item"));
+ v->write(writer, u"item"_s);
writer.writeEndElement();
}
@@ -1771,52 +1738,52 @@ void DomLayoutItem::read(QXmlStreamReader &reader)
const QXmlStreamAttributes &attributes = reader.attributes();
for (const QXmlStreamAttribute &attribute : attributes) {
const auto name = attribute.name();
- if (name == QLatin1String("row")) {
+ if (name == u"row"_s) {
setAttributeRow(attribute.value().toInt());
continue;
}
- if (name == QLatin1String("column")) {
+ if (name == u"column"_s) {
setAttributeColumn(attribute.value().toInt());
continue;
}
- if (name == QLatin1String("rowspan")) {
+ if (name == u"rowspan"_s) {
setAttributeRowSpan(attribute.value().toInt());
continue;
}
- if (name == QLatin1String("colspan")) {
+ if (name == u"colspan"_s) {
setAttributeColSpan(attribute.value().toInt());
continue;
}
- if (name == QLatin1String("alignment")) {
+ if (name == u"alignment"_s) {
setAttributeAlignment(attribute.value().toString());
continue;
}
- reader.raiseError(QLatin1String("Unexpected attribute ") + name);
+ reader.raiseError("Unexpected attribute "_L1 + name);
}
while (!reader.hasError()) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- if (!tag.compare(QLatin1String("widget"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"widget"_s, Qt::CaseInsensitive)) {
auto *v = new DomWidget();
v->read(reader);
setElementWidget(v);
continue;
}
- if (!tag.compare(QLatin1String("layout"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"layout"_s, Qt::CaseInsensitive)) {
auto *v = new DomLayout();
v->read(reader);
setElementLayout(v);
continue;
}
- if (!tag.compare(QLatin1String("spacer"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"spacer"_s, Qt::CaseInsensitive)) {
auto *v = new DomSpacer();
v->read(reader);
setElementSpacer(v);
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -1832,34 +1799,34 @@ void DomLayoutItem::write(QXmlStreamWriter &writer, const QString &tagName) cons
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("layoutitem") : tagName.toLower());
if (hasAttributeRow())
- writer.writeAttribute(QStringLiteral("row"), QString::number(attributeRow()));
+ writer.writeAttribute(u"row"_s, QString::number(attributeRow()));
if (hasAttributeColumn())
- writer.writeAttribute(QStringLiteral("column"), QString::number(attributeColumn()));
+ writer.writeAttribute(u"column"_s, QString::number(attributeColumn()));
if (hasAttributeRowSpan())
- writer.writeAttribute(QStringLiteral("rowspan"), QString::number(attributeRowSpan()));
+ writer.writeAttribute(u"rowspan"_s, QString::number(attributeRowSpan()));
if (hasAttributeColSpan())
- writer.writeAttribute(QStringLiteral("colspan"), QString::number(attributeColSpan()));
+ writer.writeAttribute(u"colspan"_s, QString::number(attributeColSpan()));
if (hasAttributeAlignment())
- writer.writeAttribute(QStringLiteral("alignment"), attributeAlignment());
+ writer.writeAttribute(u"alignment"_s, attributeAlignment());
switch (kind()) {
case Widget:
if (m_widget != nullptr)
- m_widget->write(writer, QStringLiteral("widget"));
+ m_widget->write(writer, u"widget"_s);
break;
case Layout:
if (m_layout != nullptr)
- m_layout->write(writer, QStringLiteral("layout"));
+ m_layout->write(writer, u"layout"_s);
break;
case Spacer:
if (m_spacer != nullptr)
- m_spacer->write(writer, QStringLiteral("spacer"));
+ m_spacer->write(writer, u"spacer"_s);
break;
default:
@@ -1922,13 +1889,13 @@ void DomRow::read(QXmlStreamReader &reader)
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- if (!tag.compare(QLatin1String("property"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"property"_s, Qt::CaseInsensitive)) {
auto *v = new DomProperty();
v->read(reader);
m_property.append(v);
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -1944,7 +1911,7 @@ void DomRow::write(QXmlStreamWriter &writer, const QString &tagName) const
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("row") : tagName.toLower());
for (DomProperty *v : m_property)
- v->write(writer, QStringLiteral("property"));
+ v->write(writer, u"property"_s);
writer.writeEndElement();
}
@@ -1967,13 +1934,13 @@ void DomColumn::read(QXmlStreamReader &reader)
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- if (!tag.compare(QLatin1String("property"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"property"_s, Qt::CaseInsensitive)) {
auto *v = new DomProperty();
v->read(reader);
m_property.append(v);
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -1989,7 +1956,7 @@ void DomColumn::write(QXmlStreamWriter &writer, const QString &tagName) const
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("column") : tagName.toLower());
for (DomProperty *v : m_property)
- v->write(writer, QStringLiteral("property"));
+ v->write(writer, u"property"_s);
writer.writeEndElement();
}
@@ -2013,34 +1980,34 @@ void DomItem::read(QXmlStreamReader &reader)
const QXmlStreamAttributes &attributes = reader.attributes();
for (const QXmlStreamAttribute &attribute : attributes) {
const auto name = attribute.name();
- if (name == QLatin1String("row")) {
+ if (name == u"row"_s) {
setAttributeRow(attribute.value().toInt());
continue;
}
- if (name == QLatin1String("column")) {
+ if (name == u"column"_s) {
setAttributeColumn(attribute.value().toInt());
continue;
}
- reader.raiseError(QLatin1String("Unexpected attribute ") + name);
+ reader.raiseError("Unexpected attribute "_L1 + name);
}
while (!reader.hasError()) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- if (!tag.compare(QLatin1String("property"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"property"_s, Qt::CaseInsensitive)) {
auto *v = new DomProperty();
v->read(reader);
m_property.append(v);
continue;
}
- if (!tag.compare(QLatin1String("item"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"item"_s, Qt::CaseInsensitive)) {
auto *v = new DomItem();
v->read(reader);
m_item.append(v);
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -2056,16 +2023,16 @@ void DomItem::write(QXmlStreamWriter &writer, const QString &tagName) const
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("item") : tagName.toLower());
if (hasAttributeRow())
- writer.writeAttribute(QStringLiteral("row"), QString::number(attributeRow()));
+ writer.writeAttribute(u"row"_s, QString::number(attributeRow()));
if (hasAttributeColumn())
- writer.writeAttribute(QStringLiteral("column"), QString::number(attributeColumn()));
+ writer.writeAttribute(u"column"_s, QString::number(attributeColumn()));
for (DomProperty *v : m_property)
- v->write(writer, QStringLiteral("property"));
+ v->write(writer, u"property"_s);
for (DomItem *v : m_item)
- v->write(writer, QStringLiteral("item"));
+ v->write(writer, u"item"_s);
writer.writeEndElement();
}
@@ -2113,104 +2080,104 @@ void DomWidget::read(QXmlStreamReader &reader)
const QXmlStreamAttributes &attributes = reader.attributes();
for (const QXmlStreamAttribute &attribute : attributes) {
const auto name = attribute.name();
- if (name == QLatin1String("class")) {
+ if (name == u"class"_s) {
setAttributeClass(attribute.value().toString());
continue;
}
- if (name == QLatin1String("name")) {
+ if (name == u"name"_s) {
setAttributeName(attribute.value().toString());
continue;
}
- if (name == QLatin1String("native")) {
- setAttributeNative(attribute.value() == QLatin1String("true"));
+ if (name == u"native"_s) {
+ setAttributeNative(attribute.value() == u"true"_s);
continue;
}
- reader.raiseError(QLatin1String("Unexpected attribute ") + name);
+ reader.raiseError("Unexpected attribute "_L1 + name);
}
while (!reader.hasError()) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- if (!tag.compare(QLatin1String("class"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"class"_s, Qt::CaseInsensitive)) {
m_class.append(reader.readElementText());
continue;
}
- if (!tag.compare(QLatin1String("property"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"property"_s, Qt::CaseInsensitive)) {
auto *v = new DomProperty();
v->read(reader);
m_property.append(v);
continue;
}
- if (!tag.compare(QLatin1String("script"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"script"_s, Qt::CaseInsensitive)) {
qWarning("Omitting deprecated element <script>.");
reader.skipCurrentElement();
continue;
}
- if (!tag.compare(QLatin1String("widgetdata"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"widgetdata"_s, Qt::CaseInsensitive)) {
qWarning("Omitting deprecated element <widgetdata>.");
reader.skipCurrentElement();
continue;
}
- if (!tag.compare(QLatin1String("attribute"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"attribute"_s, Qt::CaseInsensitive)) {
auto *v = new DomProperty();
v->read(reader);
m_attribute.append(v);
continue;
}
- if (!tag.compare(QLatin1String("row"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"row"_s, Qt::CaseInsensitive)) {
auto *v = new DomRow();
v->read(reader);
m_row.append(v);
continue;
}
- if (!tag.compare(QLatin1String("column"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"column"_s, Qt::CaseInsensitive)) {
auto *v = new DomColumn();
v->read(reader);
m_column.append(v);
continue;
}
- if (!tag.compare(QLatin1String("item"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"item"_s, Qt::CaseInsensitive)) {
auto *v = new DomItem();
v->read(reader);
m_item.append(v);
continue;
}
- if (!tag.compare(QLatin1String("layout"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"layout"_s, Qt::CaseInsensitive)) {
auto *v = new DomLayout();
v->read(reader);
m_layout.append(v);
continue;
}
- if (!tag.compare(QLatin1String("widget"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"widget"_s, Qt::CaseInsensitive)) {
auto *v = new DomWidget();
v->read(reader);
m_widget.append(v);
continue;
}
- if (!tag.compare(QLatin1String("action"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"action"_s, Qt::CaseInsensitive)) {
auto *v = new DomAction();
v->read(reader);
m_action.append(v);
continue;
}
- if (!tag.compare(QLatin1String("actiongroup"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"actiongroup"_s, Qt::CaseInsensitive)) {
auto *v = new DomActionGroup();
v->read(reader);
m_actionGroup.append(v);
continue;
}
- if (!tag.compare(QLatin1String("addaction"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"addaction"_s, Qt::CaseInsensitive)) {
auto *v = new DomActionRef();
v->read(reader);
m_addAction.append(v);
continue;
}
- if (!tag.compare(QLatin1String("zorder"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"zorder"_s, Qt::CaseInsensitive)) {
m_zOrder.append(reader.readElementText());
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -2226,49 +2193,49 @@ void DomWidget::write(QXmlStreamWriter &writer, const QString &tagName) const
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("widget") : tagName.toLower());
if (hasAttributeClass())
- writer.writeAttribute(QStringLiteral("class"), attributeClass());
+ writer.writeAttribute(u"class"_s, attributeClass());
if (hasAttributeName())
- writer.writeAttribute(QStringLiteral("name"), attributeName());
+ writer.writeAttribute(u"name"_s, attributeName());
if (hasAttributeNative())
- writer.writeAttribute(QStringLiteral("native"), (attributeNative() ? QLatin1String("true") : QLatin1String("false")));
+ writer.writeAttribute(u"native"_s, (attributeNative() ? u"true"_s : u"false"_s));
for (const QString &v : m_class)
- writer.writeTextElement(QStringLiteral("class"), v);
+ writer.writeTextElement(u"class"_s, v);
for (DomProperty *v : m_property)
- v->write(writer, QStringLiteral("property"));
+ v->write(writer, u"property"_s);
for (DomProperty *v : m_attribute)
- v->write(writer, QStringLiteral("attribute"));
+ v->write(writer, u"attribute"_s);
for (DomRow *v : m_row)
- v->write(writer, QStringLiteral("row"));
+ v->write(writer, u"row"_s);
for (DomColumn *v : m_column)
- v->write(writer, QStringLiteral("column"));
+ v->write(writer, u"column"_s);
for (DomItem *v : m_item)
- v->write(writer, QStringLiteral("item"));
+ v->write(writer, u"item"_s);
for (DomLayout *v : m_layout)
- v->write(writer, QStringLiteral("layout"));
+ v->write(writer, u"layout"_s);
for (DomWidget *v : m_widget)
- v->write(writer, QStringLiteral("widget"));
+ v->write(writer, u"widget"_s);
for (DomAction *v : m_action)
- v->write(writer, QStringLiteral("action"));
+ v->write(writer, u"action"_s);
for (DomActionGroup *v : m_actionGroup)
- v->write(writer, QStringLiteral("actiongroup"));
+ v->write(writer, u"actiongroup"_s);
for (DomActionRef *v : m_addAction)
- v->write(writer, QStringLiteral("addaction"));
+ v->write(writer, u"addaction"_s);
for (const QString &v : m_zOrder)
- writer.writeTextElement(QStringLiteral("zorder"), v);
+ writer.writeTextElement(u"zorder"_s, v);
writer.writeEndElement();
}
@@ -2356,24 +2323,24 @@ void DomSpacer::read(QXmlStreamReader &reader)
const QXmlStreamAttributes &attributes = reader.attributes();
for (const QXmlStreamAttribute &attribute : attributes) {
const auto name = attribute.name();
- if (name == QLatin1String("name")) {
+ if (name == u"name"_s) {
setAttributeName(attribute.value().toString());
continue;
}
- reader.raiseError(QLatin1String("Unexpected attribute ") + name);
+ reader.raiseError("Unexpected attribute "_L1 + name);
}
while (!reader.hasError()) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- if (!tag.compare(QLatin1String("property"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"property"_s, Qt::CaseInsensitive)) {
auto *v = new DomProperty();
v->read(reader);
m_property.append(v);
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -2389,10 +2356,10 @@ void DomSpacer::write(QXmlStreamWriter &writer, const QString &tagName) const
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("spacer") : tagName.toLower());
if (hasAttributeName())
- writer.writeAttribute(QStringLiteral("name"), attributeName());
+ writer.writeAttribute(u"name"_s, attributeName());
for (DomProperty *v : m_property)
- v->write(writer, QStringLiteral("property"));
+ v->write(writer, u"property"_s);
writer.writeEndElement();
}
@@ -2410,30 +2377,30 @@ void DomColor::read(QXmlStreamReader &reader)
const QXmlStreamAttributes &attributes = reader.attributes();
for (const QXmlStreamAttribute &attribute : attributes) {
const auto name = attribute.name();
- if (name == QLatin1String("alpha")) {
+ if (name == u"alpha"_s) {
setAttributeAlpha(attribute.value().toInt());
continue;
}
- reader.raiseError(QLatin1String("Unexpected attribute ") + name);
+ reader.raiseError("Unexpected attribute "_L1 + name);
}
while (!reader.hasError()) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- if (!tag.compare(QLatin1String("red"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"red"_s, Qt::CaseInsensitive)) {
setElementRed(reader.readElementText().toInt());
continue;
}
- if (!tag.compare(QLatin1String("green"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"green"_s, Qt::CaseInsensitive)) {
setElementGreen(reader.readElementText().toInt());
continue;
}
- if (!tag.compare(QLatin1String("blue"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"blue"_s, Qt::CaseInsensitive)) {
setElementBlue(reader.readElementText().toInt());
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -2449,16 +2416,16 @@ void DomColor::write(QXmlStreamWriter &writer, const QString &tagName) const
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("color") : tagName.toLower());
if (hasAttributeAlpha())
- writer.writeAttribute(QStringLiteral("alpha"), QString::number(attributeAlpha()));
+ writer.writeAttribute(u"alpha"_s, QString::number(attributeAlpha()));
if (m_children & Red)
- writer.writeTextElement(QStringLiteral("red"), QString::number(m_red));
+ writer.writeTextElement(u"red"_s, QString::number(m_red));
if (m_children & Green)
- writer.writeTextElement(QStringLiteral("green"), QString::number(m_green));
+ writer.writeTextElement(u"green"_s, QString::number(m_green));
if (m_children & Blue)
- writer.writeTextElement(QStringLiteral("blue"), QString::number(m_blue));
+ writer.writeTextElement(u"blue"_s, QString::number(m_blue));
writer.writeEndElement();
}
@@ -2506,24 +2473,24 @@ void DomGradientStop::read(QXmlStreamReader &reader)
const QXmlStreamAttributes &attributes = reader.attributes();
for (const QXmlStreamAttribute &attribute : attributes) {
const auto name = attribute.name();
- if (name == QLatin1String("position")) {
+ if (name == u"position"_s) {
setAttributePosition(attribute.value().toDouble());
continue;
}
- reader.raiseError(QLatin1String("Unexpected attribute ") + name);
+ reader.raiseError("Unexpected attribute "_L1 + name);
}
while (!reader.hasError()) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- if (!tag.compare(QLatin1String("color"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"color"_s, Qt::CaseInsensitive)) {
auto *v = new DomColor();
v->read(reader);
setElementColor(v);
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -2539,10 +2506,10 @@ void DomGradientStop::write(QXmlStreamWriter &writer, const QString &tagName) co
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("gradientstop") : tagName.toLower());
if (hasAttributePosition())
- writer.writeAttribute(QStringLiteral("position"), QString::number(attributePosition(), 'f', 15));
+ writer.writeAttribute(u"position"_s, QString::number(attributePosition(), 'f', 15));
if (m_children & Color)
- m_color->write(writer, QStringLiteral("color"));
+ m_color->write(writer, u"color"_s);
writer.writeEndElement();
}
@@ -2580,72 +2547,72 @@ void DomGradient::read(QXmlStreamReader &reader)
const QXmlStreamAttributes &attributes = reader.attributes();
for (const QXmlStreamAttribute &attribute : attributes) {
const auto name = attribute.name();
- if (name == QLatin1String("startx")) {
+ if (name == u"startx"_s) {
setAttributeStartX(attribute.value().toDouble());
continue;
}
- if (name == QLatin1String("starty")) {
+ if (name == u"starty"_s) {
setAttributeStartY(attribute.value().toDouble());
continue;
}
- if (name == QLatin1String("endx")) {
+ if (name == u"endx"_s) {
setAttributeEndX(attribute.value().toDouble());
continue;
}
- if (name == QLatin1String("endy")) {
+ if (name == u"endy"_s) {
setAttributeEndY(attribute.value().toDouble());
continue;
}
- if (name == QLatin1String("centralx")) {
+ if (name == u"centralx"_s) {
setAttributeCentralX(attribute.value().toDouble());
continue;
}
- if (name == QLatin1String("centraly")) {
+ if (name == u"centraly"_s) {
setAttributeCentralY(attribute.value().toDouble());
continue;
}
- if (name == QLatin1String("focalx")) {
+ if (name == u"focalx"_s) {
setAttributeFocalX(attribute.value().toDouble());
continue;
}
- if (name == QLatin1String("focaly")) {
+ if (name == u"focaly"_s) {
setAttributeFocalY(attribute.value().toDouble());
continue;
}
- if (name == QLatin1String("radius")) {
+ if (name == u"radius"_s) {
setAttributeRadius(attribute.value().toDouble());
continue;
}
- if (name == QLatin1String("angle")) {
+ if (name == u"angle"_s) {
setAttributeAngle(attribute.value().toDouble());
continue;
}
- if (name == QLatin1String("type")) {
+ if (name == u"type"_s) {
setAttributeType(attribute.value().toString());
continue;
}
- if (name == QLatin1String("spread")) {
+ if (name == u"spread"_s) {
setAttributeSpread(attribute.value().toString());
continue;
}
- if (name == QLatin1String("coordinatemode")) {
+ if (name == u"coordinatemode"_s) {
setAttributeCoordinateMode(attribute.value().toString());
continue;
}
- reader.raiseError(QLatin1String("Unexpected attribute ") + name);
+ reader.raiseError("Unexpected attribute "_L1 + name);
}
while (!reader.hasError()) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- if (!tag.compare(QLatin1String("gradientstop"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"gradientstop"_s, Qt::CaseInsensitive)) {
auto *v = new DomGradientStop();
v->read(reader);
m_gradientStop.append(v);
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -2661,46 +2628,46 @@ void DomGradient::write(QXmlStreamWriter &writer, const QString &tagName) const
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("gradient") : tagName.toLower());
if (hasAttributeStartX())
- writer.writeAttribute(QStringLiteral("startx"), QString::number(attributeStartX(), 'f', 15));
+ writer.writeAttribute(u"startx"_s, QString::number(attributeStartX(), 'f', 15));
if (hasAttributeStartY())
- writer.writeAttribute(QStringLiteral("starty"), QString::number(attributeStartY(), 'f', 15));
+ writer.writeAttribute(u"starty"_s, QString::number(attributeStartY(), 'f', 15));
if (hasAttributeEndX())
- writer.writeAttribute(QStringLiteral("endx"), QString::number(attributeEndX(), 'f', 15));
+ writer.writeAttribute(u"endx"_s, QString::number(attributeEndX(), 'f', 15));
if (hasAttributeEndY())
- writer.writeAttribute(QStringLiteral("endy"), QString::number(attributeEndY(), 'f', 15));
+ writer.writeAttribute(u"endy"_s, QString::number(attributeEndY(), 'f', 15));
if (hasAttributeCentralX())
- writer.writeAttribute(QStringLiteral("centralx"), QString::number(attributeCentralX(), 'f', 15));
+ writer.writeAttribute(u"centralx"_s, QString::number(attributeCentralX(), 'f', 15));
if (hasAttributeCentralY())
- writer.writeAttribute(QStringLiteral("centraly"), QString::number(attributeCentralY(), 'f', 15));
+ writer.writeAttribute(u"centraly"_s, QString::number(attributeCentralY(), 'f', 15));
if (hasAttributeFocalX())
- writer.writeAttribute(QStringLiteral("focalx"), QString::number(attributeFocalX(), 'f', 15));
+ writer.writeAttribute(u"focalx"_s, QString::number(attributeFocalX(), 'f', 15));
if (hasAttributeFocalY())
- writer.writeAttribute(QStringLiteral("focaly"), QString::number(attributeFocalY(), 'f', 15));
+ writer.writeAttribute(u"focaly"_s, QString::number(attributeFocalY(), 'f', 15));
if (hasAttributeRadius())
- writer.writeAttribute(QStringLiteral("radius"), QString::number(attributeRadius(), 'f', 15));
+ writer.writeAttribute(u"radius"_s, QString::number(attributeRadius(), 'f', 15));
if (hasAttributeAngle())
- writer.writeAttribute(QStringLiteral("angle"), QString::number(attributeAngle(), 'f', 15));
+ writer.writeAttribute(u"angle"_s, QString::number(attributeAngle(), 'f', 15));
if (hasAttributeType())
- writer.writeAttribute(QStringLiteral("type"), attributeType());
+ writer.writeAttribute(u"type"_s, attributeType());
if (hasAttributeSpread())
- writer.writeAttribute(QStringLiteral("spread"), attributeSpread());
+ writer.writeAttribute(u"spread"_s, attributeSpread());
if (hasAttributeCoordinateMode())
- writer.writeAttribute(QStringLiteral("coordinatemode"), attributeCoordinateMode());
+ writer.writeAttribute(u"coordinatemode"_s, attributeCoordinateMode());
for (DomGradientStop *v : m_gradientStop)
- v->write(writer, QStringLiteral("gradientstop"));
+ v->write(writer, u"gradientstop"_s);
writer.writeEndElement();
}
@@ -2736,36 +2703,36 @@ void DomBrush::read(QXmlStreamReader &reader)
const QXmlStreamAttributes &attributes = reader.attributes();
for (const QXmlStreamAttribute &attribute : attributes) {
const auto name = attribute.name();
- if (name == QLatin1String("brushstyle")) {
+ if (name == u"brushstyle"_s) {
setAttributeBrushStyle(attribute.value().toString());
continue;
}
- reader.raiseError(QLatin1String("Unexpected attribute ") + name);
+ reader.raiseError("Unexpected attribute "_L1 + name);
}
while (!reader.hasError()) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- if (!tag.compare(QLatin1String("color"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"color"_s, Qt::CaseInsensitive)) {
auto *v = new DomColor();
v->read(reader);
setElementColor(v);
continue;
}
- if (!tag.compare(QLatin1String("texture"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"texture"_s, Qt::CaseInsensitive)) {
auto *v = new DomProperty();
v->read(reader);
setElementTexture(v);
continue;
}
- if (!tag.compare(QLatin1String("gradient"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"gradient"_s, Qt::CaseInsensitive)) {
auto *v = new DomGradient();
v->read(reader);
setElementGradient(v);
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -2781,22 +2748,22 @@ void DomBrush::write(QXmlStreamWriter &writer, const QString &tagName) const
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("brush") : tagName.toLower());
if (hasAttributeBrushStyle())
- writer.writeAttribute(QStringLiteral("brushstyle"), attributeBrushStyle());
+ writer.writeAttribute(u"brushstyle"_s, attributeBrushStyle());
switch (kind()) {
case Color:
if (m_color != nullptr)
- m_color->write(writer, QStringLiteral("color"));
+ m_color->write(writer, u"color"_s);
break;
case Texture:
if (m_texture != nullptr)
- m_texture->write(writer, QStringLiteral("texture"));
+ m_texture->write(writer, u"texture"_s);
break;
case Gradient:
if (m_gradient != nullptr)
- m_gradient->write(writer, QStringLiteral("gradient"));
+ m_gradient->write(writer, u"gradient"_s);
break;
default:
@@ -2857,24 +2824,24 @@ void DomColorRole::read(QXmlStreamReader &reader)
const QXmlStreamAttributes &attributes = reader.attributes();
for (const QXmlStreamAttribute &attribute : attributes) {
const auto name = attribute.name();
- if (name == QLatin1String("role")) {
+ if (name == u"role"_s) {
setAttributeRole(attribute.value().toString());
continue;
}
- reader.raiseError(QLatin1String("Unexpected attribute ") + name);
+ reader.raiseError("Unexpected attribute "_L1 + name);
}
while (!reader.hasError()) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- if (!tag.compare(QLatin1String("brush"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"brush"_s, Qt::CaseInsensitive)) {
auto *v = new DomBrush();
v->read(reader);
setElementBrush(v);
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -2890,10 +2857,10 @@ void DomColorRole::write(QXmlStreamWriter &writer, const QString &tagName) const
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("colorrole") : tagName.toLower());
if (hasAttributeRole())
- writer.writeAttribute(QStringLiteral("role"), attributeRole());
+ writer.writeAttribute(u"role"_s, attributeRole());
if (m_children & Brush)
- m_brush->write(writer, QStringLiteral("brush"));
+ m_brush->write(writer, u"brush"_s);
writer.writeEndElement();
}
@@ -2934,19 +2901,19 @@ void DomColorGroup::read(QXmlStreamReader &reader)
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- if (!tag.compare(QLatin1String("colorrole"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"colorrole"_s, Qt::CaseInsensitive)) {
auto *v = new DomColorRole();
v->read(reader);
m_colorRole.append(v);
continue;
}
- if (!tag.compare(QLatin1String("color"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"color"_s, Qt::CaseInsensitive)) {
auto *v = new DomColor();
v->read(reader);
m_color.append(v);
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -2962,10 +2929,10 @@ void DomColorGroup::write(QXmlStreamWriter &writer, const QString &tagName) cons
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("colorgroup") : tagName.toLower());
for (DomColorRole *v : m_colorRole)
- v->write(writer, QStringLiteral("colorrole"));
+ v->write(writer, u"colorrole"_s);
for (DomColor *v : m_color)
- v->write(writer, QStringLiteral("color"));
+ v->write(writer, u"color"_s);
writer.writeEndElement();
}
@@ -2995,25 +2962,25 @@ void DomPalette::read(QXmlStreamReader &reader)
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- if (!tag.compare(QLatin1String("active"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"active"_s, Qt::CaseInsensitive)) {
auto *v = new DomColorGroup();
v->read(reader);
setElementActive(v);
continue;
}
- if (!tag.compare(QLatin1String("inactive"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"inactive"_s, Qt::CaseInsensitive)) {
auto *v = new DomColorGroup();
v->read(reader);
setElementInactive(v);
continue;
}
- if (!tag.compare(QLatin1String("disabled"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"disabled"_s, Qt::CaseInsensitive)) {
auto *v = new DomColorGroup();
v->read(reader);
setElementDisabled(v);
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -3029,13 +2996,13 @@ void DomPalette::write(QXmlStreamWriter &writer, const QString &tagName) const
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("palette") : tagName.toLower());
if (m_children & Active)
- m_active->write(writer, QStringLiteral("active"));
+ m_active->write(writer, u"active"_s);
if (m_children & Inactive)
- m_inactive->write(writer, QStringLiteral("inactive"));
+ m_inactive->write(writer, u"inactive"_s);
if (m_children & Disabled)
- m_disabled->write(writer, QStringLiteral("disabled"));
+ m_disabled->write(writer, u"disabled"_s);
writer.writeEndElement();
}
@@ -3114,47 +3081,55 @@ void DomFont::read(QXmlStreamReader &reader)
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- if (!tag.compare(QLatin1String("family"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"family"_s, Qt::CaseInsensitive)) {
setElementFamily(reader.readElementText());
continue;
}
- if (!tag.compare(QLatin1String("pointsize"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"pointsize"_s, Qt::CaseInsensitive)) {
setElementPointSize(reader.readElementText().toInt());
continue;
}
- if (!tag.compare(QLatin1String("weight"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"weight"_s, Qt::CaseInsensitive)) {
setElementWeight(reader.readElementText().toInt());
continue;
}
- if (!tag.compare(QLatin1String("italic"), Qt::CaseInsensitive)) {
- setElementItalic(reader.readElementText() == QLatin1String("true"));
+ if (!tag.compare(u"italic"_s, Qt::CaseInsensitive)) {
+ setElementItalic(reader.readElementText() == u"true"_s);
continue;
}
- if (!tag.compare(QLatin1String("bold"), Qt::CaseInsensitive)) {
- setElementBold(reader.readElementText() == QLatin1String("true"));
+ if (!tag.compare(u"bold"_s, Qt::CaseInsensitive)) {
+ setElementBold(reader.readElementText() == u"true"_s);
continue;
}
- if (!tag.compare(QLatin1String("underline"), Qt::CaseInsensitive)) {
- setElementUnderline(reader.readElementText() == QLatin1String("true"));
+ if (!tag.compare(u"underline"_s, Qt::CaseInsensitive)) {
+ setElementUnderline(reader.readElementText() == u"true"_s);
continue;
}
- if (!tag.compare(QLatin1String("strikeout"), Qt::CaseInsensitive)) {
- setElementStrikeOut(reader.readElementText() == QLatin1String("true"));
+ if (!tag.compare(u"strikeout"_s, Qt::CaseInsensitive)) {
+ setElementStrikeOut(reader.readElementText() == u"true"_s);
continue;
}
- if (!tag.compare(QLatin1String("antialiasing"), Qt::CaseInsensitive)) {
- setElementAntialiasing(reader.readElementText() == QLatin1String("true"));
+ if (!tag.compare(u"antialiasing"_s, Qt::CaseInsensitive)) {
+ setElementAntialiasing(reader.readElementText() == u"true"_s);
continue;
}
- if (!tag.compare(QLatin1String("stylestrategy"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"stylestrategy"_s, Qt::CaseInsensitive)) {
setElementStyleStrategy(reader.readElementText());
continue;
}
- if (!tag.compare(QLatin1String("kerning"), Qt::CaseInsensitive)) {
- setElementKerning(reader.readElementText() == QLatin1String("true"));
+ if (!tag.compare(u"kerning"_s, Qt::CaseInsensitive)) {
+ setElementKerning(reader.readElementText() == u"true"_s);
+ continue;
+ }
+ if (!tag.compare(u"hintingpreference"_s, Qt::CaseInsensitive)) {
+ setElementHintingPreference(reader.readElementText());
+ continue;
+ }
+ if (!tag.compare(u"fontweight"_s, Qt::CaseInsensitive)) {
+ setElementFontWeight(reader.readElementText());
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -3170,34 +3145,40 @@ void DomFont::write(QXmlStreamWriter &writer, const QString &tagName) const
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("font") : tagName.toLower());
if (m_children & Family)
- writer.writeTextElement(QStringLiteral("family"), m_family);
+ writer.writeTextElement(u"family"_s, m_family);
if (m_children & PointSize)
- writer.writeTextElement(QStringLiteral("pointsize"), QString::number(m_pointSize));
+ writer.writeTextElement(u"pointsize"_s, QString::number(m_pointSize));
if (m_children & Weight)
- writer.writeTextElement(QStringLiteral("weight"), QString::number(m_weight));
+ writer.writeTextElement(u"weight"_s, QString::number(m_weight));
if (m_children & Italic)
- writer.writeTextElement(QStringLiteral("italic"), (m_italic ? QLatin1String("true") : QLatin1String("false")));
+ writer.writeTextElement(u"italic"_s, (m_italic ? u"true"_s : u"false"_s));
if (m_children & Bold)
- writer.writeTextElement(QStringLiteral("bold"), (m_bold ? QLatin1String("true") : QLatin1String("false")));
+ writer.writeTextElement(u"bold"_s, (m_bold ? u"true"_s : u"false"_s));
if (m_children & Underline)
- writer.writeTextElement(QStringLiteral("underline"), (m_underline ? QLatin1String("true") : QLatin1String("false")));
+ writer.writeTextElement(u"underline"_s, (m_underline ? u"true"_s : u"false"_s));
if (m_children & StrikeOut)
- writer.writeTextElement(QStringLiteral("strikeout"), (m_strikeOut ? QLatin1String("true") : QLatin1String("false")));
+ writer.writeTextElement(u"strikeout"_s, (m_strikeOut ? u"true"_s : u"false"_s));
if (m_children & Antialiasing)
- writer.writeTextElement(QStringLiteral("antialiasing"), (m_antialiasing ? QLatin1String("true") : QLatin1String("false")));
+ writer.writeTextElement(u"antialiasing"_s, (m_antialiasing ? u"true"_s : u"false"_s));
if (m_children & StyleStrategy)
- writer.writeTextElement(QStringLiteral("stylestrategy"), m_styleStrategy);
+ writer.writeTextElement(u"stylestrategy"_s, m_styleStrategy);
if (m_children & Kerning)
- writer.writeTextElement(QStringLiteral("kerning"), (m_kerning ? QLatin1String("true") : QLatin1String("false")));
+ writer.writeTextElement(u"kerning"_s, (m_kerning ? u"true"_s : u"false"_s));
+
+ if (m_children & HintingPreference)
+ writer.writeTextElement(u"hintingpreference"_s, m_hintingPreference);
+
+ if (m_children & FontWeight)
+ writer.writeTextElement(u"fontweight"_s, m_fontWeight);
writer.writeEndElement();
}
@@ -3262,6 +3243,18 @@ void DomFont::setElementKerning(bool a)
m_kerning = a;
}
+void DomFont::setElementHintingPreference(const QString &a)
+{
+ m_children |= HintingPreference;
+ m_hintingPreference = a;
+}
+
+void DomFont::setElementFontWeight(const QString &a)
+{
+ m_children |= FontWeight;
+ m_fontWeight = a;
+}
+
void DomFont::clearElementFamily()
{
m_children &= ~Family;
@@ -3312,6 +3305,16 @@ void DomFont::clearElementKerning()
m_children &= ~Kerning;
}
+void DomFont::clearElementHintingPreference()
+{
+ m_children &= ~HintingPreference;
+}
+
+void DomFont::clearElementFontWeight()
+{
+ m_children &= ~FontWeight;
+}
+
DomPoint::~DomPoint() = default;
void DomPoint::read(QXmlStreamReader &reader)
@@ -3320,15 +3323,15 @@ void DomPoint::read(QXmlStreamReader &reader)
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- if (!tag.compare(QLatin1String("x"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"x"_s, Qt::CaseInsensitive)) {
setElementX(reader.readElementText().toInt());
continue;
}
- if (!tag.compare(QLatin1String("y"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"y"_s, Qt::CaseInsensitive)) {
setElementY(reader.readElementText().toInt());
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -3344,10 +3347,10 @@ void DomPoint::write(QXmlStreamWriter &writer, const QString &tagName) const
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("point") : tagName.toLower());
if (m_children & X)
- writer.writeTextElement(QString(QLatin1Char('x')), QString::number(m_x));
+ writer.writeTextElement(u"x"_s, QString::number(m_x));
if (m_children & Y)
- writer.writeTextElement(QString(QLatin1Char('y')), QString::number(m_y));
+ writer.writeTextElement(u"y"_s, QString::number(m_y));
writer.writeEndElement();
}
@@ -3382,23 +3385,23 @@ void DomRect::read(QXmlStreamReader &reader)
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- if (!tag.compare(QLatin1String("x"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"x"_s, Qt::CaseInsensitive)) {
setElementX(reader.readElementText().toInt());
continue;
}
- if (!tag.compare(QLatin1String("y"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"y"_s, Qt::CaseInsensitive)) {
setElementY(reader.readElementText().toInt());
continue;
}
- if (!tag.compare(QLatin1String("width"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"width"_s, Qt::CaseInsensitive)) {
setElementWidth(reader.readElementText().toInt());
continue;
}
- if (!tag.compare(QLatin1String("height"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"height"_s, Qt::CaseInsensitive)) {
setElementHeight(reader.readElementText().toInt());
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -3414,16 +3417,16 @@ void DomRect::write(QXmlStreamWriter &writer, const QString &tagName) const
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("rect") : tagName.toLower());
if (m_children & X)
- writer.writeTextElement(QString(QLatin1Char('x')), QString::number(m_x));
+ writer.writeTextElement(u"x"_s, QString::number(m_x));
if (m_children & Y)
- writer.writeTextElement(QString(QLatin1Char('y')), QString::number(m_y));
+ writer.writeTextElement(u"y"_s, QString::number(m_y));
if (m_children & Width)
- writer.writeTextElement(QStringLiteral("width"), QString::number(m_width));
+ writer.writeTextElement(u"width"_s, QString::number(m_width));
if (m_children & Height)
- writer.writeTextElement(QStringLiteral("height"), QString::number(m_height));
+ writer.writeTextElement(u"height"_s, QString::number(m_height));
writer.writeEndElement();
}
@@ -3479,22 +3482,22 @@ void DomLocale::read(QXmlStreamReader &reader)
const QXmlStreamAttributes &attributes = reader.attributes();
for (const QXmlStreamAttribute &attribute : attributes) {
const auto name = attribute.name();
- if (name == QLatin1String("language")) {
+ if (name == u"language"_s) {
setAttributeLanguage(attribute.value().toString());
continue;
}
- if (name == QLatin1String("country")) {
+ if (name == u"country"_s) {
setAttributeCountry(attribute.value().toString());
continue;
}
- reader.raiseError(QLatin1String("Unexpected attribute ") + name);
+ reader.raiseError("Unexpected attribute "_L1 + name);
}
while (!reader.hasError()) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -3510,10 +3513,10 @@ void DomLocale::write(QXmlStreamWriter &writer, const QString &tagName) const
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("locale") : tagName.toLower());
if (hasAttributeLanguage())
- writer.writeAttribute(QStringLiteral("language"), attributeLanguage());
+ writer.writeAttribute(u"language"_s, attributeLanguage());
if (hasAttributeCountry())
- writer.writeAttribute(QStringLiteral("country"), attributeCountry());
+ writer.writeAttribute(u"country"_s, attributeCountry());
writer.writeEndElement();
}
@@ -3525,38 +3528,38 @@ void DomSizePolicy::read(QXmlStreamReader &reader)
const QXmlStreamAttributes &attributes = reader.attributes();
for (const QXmlStreamAttribute &attribute : attributes) {
const auto name = attribute.name();
- if (name == QLatin1String("hsizetype")) {
+ if (name == u"hsizetype"_s) {
setAttributeHSizeType(attribute.value().toString());
continue;
}
- if (name == QLatin1String("vsizetype")) {
+ if (name == u"vsizetype"_s) {
setAttributeVSizeType(attribute.value().toString());
continue;
}
- reader.raiseError(QLatin1String("Unexpected attribute ") + name);
+ reader.raiseError("Unexpected attribute "_L1 + name);
}
while (!reader.hasError()) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- if (!tag.compare(QLatin1String("hsizetype"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"hsizetype"_s, Qt::CaseInsensitive)) {
setElementHSizeType(reader.readElementText().toInt());
continue;
}
- if (!tag.compare(QLatin1String("vsizetype"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"vsizetype"_s, Qt::CaseInsensitive)) {
setElementVSizeType(reader.readElementText().toInt());
continue;
}
- if (!tag.compare(QLatin1String("horstretch"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"horstretch"_s, Qt::CaseInsensitive)) {
setElementHorStretch(reader.readElementText().toInt());
continue;
}
- if (!tag.compare(QLatin1String("verstretch"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"verstretch"_s, Qt::CaseInsensitive)) {
setElementVerStretch(reader.readElementText().toInt());
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -3572,22 +3575,22 @@ void DomSizePolicy::write(QXmlStreamWriter &writer, const QString &tagName) cons
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("sizepolicy") : tagName.toLower());
if (hasAttributeHSizeType())
- writer.writeAttribute(QStringLiteral("hsizetype"), attributeHSizeType());
+ writer.writeAttribute(u"hsizetype"_s, attributeHSizeType());
if (hasAttributeVSizeType())
- writer.writeAttribute(QStringLiteral("vsizetype"), attributeVSizeType());
+ writer.writeAttribute(u"vsizetype"_s, attributeVSizeType());
if (m_children & HSizeType)
- writer.writeTextElement(QStringLiteral("hsizetype"), QString::number(m_hSizeType));
+ writer.writeTextElement(u"hsizetype"_s, QString::number(m_hSizeType));
if (m_children & VSizeType)
- writer.writeTextElement(QStringLiteral("vsizetype"), QString::number(m_vSizeType));
+ writer.writeTextElement(u"vsizetype"_s, QString::number(m_vSizeType));
if (m_children & HorStretch)
- writer.writeTextElement(QStringLiteral("horstretch"), QString::number(m_horStretch));
+ writer.writeTextElement(u"horstretch"_s, QString::number(m_horStretch));
if (m_children & VerStretch)
- writer.writeTextElement(QStringLiteral("verstretch"), QString::number(m_verStretch));
+ writer.writeTextElement(u"verstretch"_s, QString::number(m_verStretch));
writer.writeEndElement();
}
@@ -3644,15 +3647,15 @@ void DomSize::read(QXmlStreamReader &reader)
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- if (!tag.compare(QLatin1String("width"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"width"_s, Qt::CaseInsensitive)) {
setElementWidth(reader.readElementText().toInt());
continue;
}
- if (!tag.compare(QLatin1String("height"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"height"_s, Qt::CaseInsensitive)) {
setElementHeight(reader.readElementText().toInt());
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -3668,10 +3671,10 @@ void DomSize::write(QXmlStreamWriter &writer, const QString &tagName) const
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("size") : tagName.toLower());
if (m_children & Width)
- writer.writeTextElement(QStringLiteral("width"), QString::number(m_width));
+ writer.writeTextElement(u"width"_s, QString::number(m_width));
if (m_children & Height)
- writer.writeTextElement(QStringLiteral("height"), QString::number(m_height));
+ writer.writeTextElement(u"height"_s, QString::number(m_height));
writer.writeEndElement();
}
@@ -3706,19 +3709,19 @@ void DomDate::read(QXmlStreamReader &reader)
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- if (!tag.compare(QLatin1String("year"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"year"_s, Qt::CaseInsensitive)) {
setElementYear(reader.readElementText().toInt());
continue;
}
- if (!tag.compare(QLatin1String("month"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"month"_s, Qt::CaseInsensitive)) {
setElementMonth(reader.readElementText().toInt());
continue;
}
- if (!tag.compare(QLatin1String("day"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"day"_s, Qt::CaseInsensitive)) {
setElementDay(reader.readElementText().toInt());
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -3734,13 +3737,13 @@ void DomDate::write(QXmlStreamWriter &writer, const QString &tagName) const
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("date") : tagName.toLower());
if (m_children & Year)
- writer.writeTextElement(QStringLiteral("year"), QString::number(m_year));
+ writer.writeTextElement(u"year"_s, QString::number(m_year));
if (m_children & Month)
- writer.writeTextElement(QStringLiteral("month"), QString::number(m_month));
+ writer.writeTextElement(u"month"_s, QString::number(m_month));
if (m_children & Day)
- writer.writeTextElement(QStringLiteral("day"), QString::number(m_day));
+ writer.writeTextElement(u"day"_s, QString::number(m_day));
writer.writeEndElement();
}
@@ -3786,19 +3789,19 @@ void DomTime::read(QXmlStreamReader &reader)
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- if (!tag.compare(QLatin1String("hour"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"hour"_s, Qt::CaseInsensitive)) {
setElementHour(reader.readElementText().toInt());
continue;
}
- if (!tag.compare(QLatin1String("minute"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"minute"_s, Qt::CaseInsensitive)) {
setElementMinute(reader.readElementText().toInt());
continue;
}
- if (!tag.compare(QLatin1String("second"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"second"_s, Qt::CaseInsensitive)) {
setElementSecond(reader.readElementText().toInt());
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -3814,13 +3817,13 @@ void DomTime::write(QXmlStreamWriter &writer, const QString &tagName) const
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("time") : tagName.toLower());
if (m_children & Hour)
- writer.writeTextElement(QStringLiteral("hour"), QString::number(m_hour));
+ writer.writeTextElement(u"hour"_s, QString::number(m_hour));
if (m_children & Minute)
- writer.writeTextElement(QStringLiteral("minute"), QString::number(m_minute));
+ writer.writeTextElement(u"minute"_s, QString::number(m_minute));
if (m_children & Second)
- writer.writeTextElement(QStringLiteral("second"), QString::number(m_second));
+ writer.writeTextElement(u"second"_s, QString::number(m_second));
writer.writeEndElement();
}
@@ -3866,31 +3869,31 @@ void DomDateTime::read(QXmlStreamReader &reader)
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- if (!tag.compare(QLatin1String("hour"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"hour"_s, Qt::CaseInsensitive)) {
setElementHour(reader.readElementText().toInt());
continue;
}
- if (!tag.compare(QLatin1String("minute"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"minute"_s, Qt::CaseInsensitive)) {
setElementMinute(reader.readElementText().toInt());
continue;
}
- if (!tag.compare(QLatin1String("second"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"second"_s, Qt::CaseInsensitive)) {
setElementSecond(reader.readElementText().toInt());
continue;
}
- if (!tag.compare(QLatin1String("year"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"year"_s, Qt::CaseInsensitive)) {
setElementYear(reader.readElementText().toInt());
continue;
}
- if (!tag.compare(QLatin1String("month"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"month"_s, Qt::CaseInsensitive)) {
setElementMonth(reader.readElementText().toInt());
continue;
}
- if (!tag.compare(QLatin1String("day"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"day"_s, Qt::CaseInsensitive)) {
setElementDay(reader.readElementText().toInt());
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -3906,22 +3909,22 @@ void DomDateTime::write(QXmlStreamWriter &writer, const QString &tagName) const
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("datetime") : tagName.toLower());
if (m_children & Hour)
- writer.writeTextElement(QStringLiteral("hour"), QString::number(m_hour));
+ writer.writeTextElement(u"hour"_s, QString::number(m_hour));
if (m_children & Minute)
- writer.writeTextElement(QStringLiteral("minute"), QString::number(m_minute));
+ writer.writeTextElement(u"minute"_s, QString::number(m_minute));
if (m_children & Second)
- writer.writeTextElement(QStringLiteral("second"), QString::number(m_second));
+ writer.writeTextElement(u"second"_s, QString::number(m_second));
if (m_children & Year)
- writer.writeTextElement(QStringLiteral("year"), QString::number(m_year));
+ writer.writeTextElement(u"year"_s, QString::number(m_year));
if (m_children & Month)
- writer.writeTextElement(QStringLiteral("month"), QString::number(m_month));
+ writer.writeTextElement(u"month"_s, QString::number(m_month));
if (m_children & Day)
- writer.writeTextElement(QStringLiteral("day"), QString::number(m_day));
+ writer.writeTextElement(u"day"_s, QString::number(m_day));
writer.writeEndElement();
}
@@ -4002,34 +4005,34 @@ void DomStringList::read(QXmlStreamReader &reader)
const QXmlStreamAttributes &attributes = reader.attributes();
for (const QXmlStreamAttribute &attribute : attributes) {
const auto name = attribute.name();
- if (name == QLatin1String("notr")) {
+ if (name == u"notr"_s) {
setAttributeNotr(attribute.value().toString());
continue;
}
- if (name == QLatin1String("comment")) {
+ if (name == u"comment"_s) {
setAttributeComment(attribute.value().toString());
continue;
}
- if (name == QLatin1String("extracomment")) {
+ if (name == u"extracomment"_s) {
setAttributeExtraComment(attribute.value().toString());
continue;
}
- if (name == QLatin1String("id")) {
+ if (name == u"id"_s) {
setAttributeId(attribute.value().toString());
continue;
}
- reader.raiseError(QLatin1String("Unexpected attribute ") + name);
+ reader.raiseError("Unexpected attribute "_L1 + name);
}
while (!reader.hasError()) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- if (!tag.compare(QLatin1String("string"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"string"_s, Qt::CaseInsensitive)) {
m_string.append(reader.readElementText());
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -4045,19 +4048,19 @@ void DomStringList::write(QXmlStreamWriter &writer, const QString &tagName) cons
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("stringlist") : tagName.toLower());
if (hasAttributeNotr())
- writer.writeAttribute(QStringLiteral("notr"), attributeNotr());
+ writer.writeAttribute(u"notr"_s, attributeNotr());
if (hasAttributeComment())
- writer.writeAttribute(QStringLiteral("comment"), attributeComment());
+ writer.writeAttribute(u"comment"_s, attributeComment());
if (hasAttributeExtraComment())
- writer.writeAttribute(QStringLiteral("extracomment"), attributeExtraComment());
+ writer.writeAttribute(u"extracomment"_s, attributeExtraComment());
if (hasAttributeId())
- writer.writeAttribute(QStringLiteral("id"), attributeId());
+ writer.writeAttribute(u"id"_s, attributeId());
for (const QString &v : m_string)
- writer.writeTextElement(QStringLiteral("string"), v);
+ writer.writeTextElement(u"string"_s, v);
writer.writeEndElement();
}
@@ -4075,22 +4078,22 @@ void DomResourcePixmap::read(QXmlStreamReader &reader)
const QXmlStreamAttributes &attributes = reader.attributes();
for (const QXmlStreamAttribute &attribute : attributes) {
const auto name = attribute.name();
- if (name == QLatin1String("resource")) {
+ if (name == u"resource"_s) {
setAttributeResource(attribute.value().toString());
continue;
}
- if (name == QLatin1String("alias")) {
+ if (name == u"alias"_s) {
setAttributeAlias(attribute.value().toString());
continue;
}
- reader.raiseError(QLatin1String("Unexpected attribute ") + name);
+ reader.raiseError("Unexpected attribute "_L1 + name);
}
while (!reader.hasError()) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -4110,10 +4113,10 @@ void DomResourcePixmap::write(QXmlStreamWriter &writer, const QString &tagName)
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("resourcepixmap") : tagName.toLower());
if (hasAttributeResource())
- writer.writeAttribute(QStringLiteral("resource"), attributeResource());
+ writer.writeAttribute(u"resource"_s, attributeResource());
if (hasAttributeAlias())
- writer.writeAttribute(QStringLiteral("alias"), attributeAlias());
+ writer.writeAttribute(u"alias"_s, attributeAlias());
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
@@ -4138,70 +4141,70 @@ void DomResourceIcon::read(QXmlStreamReader &reader)
const QXmlStreamAttributes &attributes = reader.attributes();
for (const QXmlStreamAttribute &attribute : attributes) {
const auto name = attribute.name();
- if (name == QLatin1String("theme")) {
+ if (name == u"theme"_s) {
setAttributeTheme(attribute.value().toString());
continue;
}
- if (name == QLatin1String("resource")) {
+ if (name == u"resource"_s) {
setAttributeResource(attribute.value().toString());
continue;
}
- reader.raiseError(QLatin1String("Unexpected attribute ") + name);
+ reader.raiseError("Unexpected attribute "_L1 + name);
}
while (!reader.hasError()) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- if (!tag.compare(QLatin1String("normaloff"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"normaloff"_s, Qt::CaseInsensitive)) {
auto *v = new DomResourcePixmap();
v->read(reader);
setElementNormalOff(v);
continue;
}
- if (!tag.compare(QLatin1String("normalon"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"normalon"_s, Qt::CaseInsensitive)) {
auto *v = new DomResourcePixmap();
v->read(reader);
setElementNormalOn(v);
continue;
}
- if (!tag.compare(QLatin1String("disabledoff"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"disabledoff"_s, Qt::CaseInsensitive)) {
auto *v = new DomResourcePixmap();
v->read(reader);
setElementDisabledOff(v);
continue;
}
- if (!tag.compare(QLatin1String("disabledon"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"disabledon"_s, Qt::CaseInsensitive)) {
auto *v = new DomResourcePixmap();
v->read(reader);
setElementDisabledOn(v);
continue;
}
- if (!tag.compare(QLatin1String("activeoff"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"activeoff"_s, Qt::CaseInsensitive)) {
auto *v = new DomResourcePixmap();
v->read(reader);
setElementActiveOff(v);
continue;
}
- if (!tag.compare(QLatin1String("activeon"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"activeon"_s, Qt::CaseInsensitive)) {
auto *v = new DomResourcePixmap();
v->read(reader);
setElementActiveOn(v);
continue;
}
- if (!tag.compare(QLatin1String("selectedoff"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"selectedoff"_s, Qt::CaseInsensitive)) {
auto *v = new DomResourcePixmap();
v->read(reader);
setElementSelectedOff(v);
continue;
}
- if (!tag.compare(QLatin1String("selectedon"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"selectedon"_s, Qt::CaseInsensitive)) {
auto *v = new DomResourcePixmap();
v->read(reader);
setElementSelectedOn(v);
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -4221,34 +4224,34 @@ void DomResourceIcon::write(QXmlStreamWriter &writer, const QString &tagName) co
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("resourceicon") : tagName.toLower());
if (hasAttributeTheme())
- writer.writeAttribute(QStringLiteral("theme"), attributeTheme());
+ writer.writeAttribute(u"theme"_s, attributeTheme());
if (hasAttributeResource())
- writer.writeAttribute(QStringLiteral("resource"), attributeResource());
+ writer.writeAttribute(u"resource"_s, attributeResource());
if (m_children & NormalOff)
- m_normalOff->write(writer, QStringLiteral("normaloff"));
+ m_normalOff->write(writer, u"normaloff"_s);
if (m_children & NormalOn)
- m_normalOn->write(writer, QStringLiteral("normalon"));
+ m_normalOn->write(writer, u"normalon"_s);
if (m_children & DisabledOff)
- m_disabledOff->write(writer, QStringLiteral("disabledoff"));
+ m_disabledOff->write(writer, u"disabledoff"_s);
if (m_children & DisabledOn)
- m_disabledOn->write(writer, QStringLiteral("disabledon"));
+ m_disabledOn->write(writer, u"disabledon"_s);
if (m_children & ActiveOff)
- m_activeOff->write(writer, QStringLiteral("activeoff"));
+ m_activeOff->write(writer, u"activeoff"_s);
if (m_children & ActiveOn)
- m_activeOn->write(writer, QStringLiteral("activeon"));
+ m_activeOn->write(writer, u"activeon"_s);
if (m_children & SelectedOff)
- m_selectedOff->write(writer, QStringLiteral("selectedoff"));
+ m_selectedOff->write(writer, u"selectedoff"_s);
if (m_children & SelectedOn)
- m_selectedOn->write(writer, QStringLiteral("selectedon"));
+ m_selectedOn->write(writer, u"selectedon"_s);
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
@@ -4439,30 +4442,30 @@ void DomString::read(QXmlStreamReader &reader)
const QXmlStreamAttributes &attributes = reader.attributes();
for (const QXmlStreamAttribute &attribute : attributes) {
const auto name = attribute.name();
- if (name == QLatin1String("notr")) {
+ if (name == u"notr"_s) {
setAttributeNotr(attribute.value().toString());
continue;
}
- if (name == QLatin1String("comment")) {
+ if (name == u"comment"_s) {
setAttributeComment(attribute.value().toString());
continue;
}
- if (name == QLatin1String("extracomment")) {
+ if (name == u"extracomment"_s) {
setAttributeExtraComment(attribute.value().toString());
continue;
}
- if (name == QLatin1String("id")) {
+ if (name == u"id"_s) {
setAttributeId(attribute.value().toString());
continue;
}
- reader.raiseError(QLatin1String("Unexpected attribute ") + name);
+ reader.raiseError("Unexpected attribute "_L1 + name);
}
while (!reader.hasError()) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -4482,16 +4485,16 @@ void DomString::write(QXmlStreamWriter &writer, const QString &tagName) const
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("string") : tagName.toLower());
if (hasAttributeNotr())
- writer.writeAttribute(QStringLiteral("notr"), attributeNotr());
+ writer.writeAttribute(u"notr"_s, attributeNotr());
if (hasAttributeComment())
- writer.writeAttribute(QStringLiteral("comment"), attributeComment());
+ writer.writeAttribute(u"comment"_s, attributeComment());
if (hasAttributeExtraComment())
- writer.writeAttribute(QStringLiteral("extracomment"), attributeExtraComment());
+ writer.writeAttribute(u"extracomment"_s, attributeExtraComment());
if (hasAttributeId())
- writer.writeAttribute(QStringLiteral("id"), attributeId());
+ writer.writeAttribute(u"id"_s, attributeId());
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
@@ -4507,15 +4510,15 @@ void DomPointF::read(QXmlStreamReader &reader)
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- if (!tag.compare(QLatin1String("x"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"x"_s, Qt::CaseInsensitive)) {
setElementX(reader.readElementText().toDouble());
continue;
}
- if (!tag.compare(QLatin1String("y"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"y"_s, Qt::CaseInsensitive)) {
setElementY(reader.readElementText().toDouble());
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -4531,10 +4534,10 @@ void DomPointF::write(QXmlStreamWriter &writer, const QString &tagName) const
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("pointf") : tagName.toLower());
if (m_children & X)
- writer.writeTextElement(QString(QLatin1Char('x')), QString::number(m_x, 'f', 15));
+ writer.writeTextElement(u"x"_s, QString::number(m_x, 'f', 15));
if (m_children & Y)
- writer.writeTextElement(QString(QLatin1Char('y')), QString::number(m_y, 'f', 15));
+ writer.writeTextElement(u"y"_s, QString::number(m_y, 'f', 15));
writer.writeEndElement();
}
@@ -4569,23 +4572,23 @@ void DomRectF::read(QXmlStreamReader &reader)
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- if (!tag.compare(QLatin1String("x"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"x"_s, Qt::CaseInsensitive)) {
setElementX(reader.readElementText().toDouble());
continue;
}
- if (!tag.compare(QLatin1String("y"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"y"_s, Qt::CaseInsensitive)) {
setElementY(reader.readElementText().toDouble());
continue;
}
- if (!tag.compare(QLatin1String("width"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"width"_s, Qt::CaseInsensitive)) {
setElementWidth(reader.readElementText().toDouble());
continue;
}
- if (!tag.compare(QLatin1String("height"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"height"_s, Qt::CaseInsensitive)) {
setElementHeight(reader.readElementText().toDouble());
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -4601,16 +4604,16 @@ void DomRectF::write(QXmlStreamWriter &writer, const QString &tagName) const
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("rectf") : tagName.toLower());
if (m_children & X)
- writer.writeTextElement(QString(QLatin1Char('x')), QString::number(m_x, 'f', 15));
+ writer.writeTextElement(u"x"_s, QString::number(m_x, 'f', 15));
if (m_children & Y)
- writer.writeTextElement(QString(QLatin1Char('y')), QString::number(m_y, 'f', 15));
+ writer.writeTextElement(u"y"_s, QString::number(m_y, 'f', 15));
if (m_children & Width)
- writer.writeTextElement(QStringLiteral("width"), QString::number(m_width, 'f', 15));
+ writer.writeTextElement(u"width"_s, QString::number(m_width, 'f', 15));
if (m_children & Height)
- writer.writeTextElement(QStringLiteral("height"), QString::number(m_height, 'f', 15));
+ writer.writeTextElement(u"height"_s, QString::number(m_height, 'f', 15));
writer.writeEndElement();
}
@@ -4667,15 +4670,15 @@ void DomSizeF::read(QXmlStreamReader &reader)
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- if (!tag.compare(QLatin1String("width"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"width"_s, Qt::CaseInsensitive)) {
setElementWidth(reader.readElementText().toDouble());
continue;
}
- if (!tag.compare(QLatin1String("height"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"height"_s, Qt::CaseInsensitive)) {
setElementHeight(reader.readElementText().toDouble());
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -4691,10 +4694,10 @@ void DomSizeF::write(QXmlStreamWriter &writer, const QString &tagName) const
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("sizef") : tagName.toLower());
if (m_children & Width)
- writer.writeTextElement(QStringLiteral("width"), QString::number(m_width, 'f', 15));
+ writer.writeTextElement(u"width"_s, QString::number(m_width, 'f', 15));
if (m_children & Height)
- writer.writeTextElement(QStringLiteral("height"), QString::number(m_height, 'f', 15));
+ writer.writeTextElement(u"height"_s, QString::number(m_height, 'f', 15));
writer.writeEndElement();
}
@@ -4729,11 +4732,11 @@ void DomChar::read(QXmlStreamReader &reader)
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- if (!tag.compare(QLatin1String("unicode"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"unicode"_s, Qt::CaseInsensitive)) {
setElementUnicode(reader.readElementText().toInt());
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -4749,7 +4752,7 @@ void DomChar::write(QXmlStreamWriter &writer, const QString &tagName) const
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("char") : tagName.toLower());
if (m_children & Unicode)
- writer.writeTextElement(QStringLiteral("unicode"), QString::number(m_unicode));
+ writer.writeTextElement(u"unicode"_s, QString::number(m_unicode));
writer.writeEndElement();
}
@@ -4776,13 +4779,13 @@ void DomUrl::read(QXmlStreamReader &reader)
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- if (!tag.compare(QLatin1String("string"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"string"_s, Qt::CaseInsensitive)) {
auto *v = new DomString();
v->read(reader);
setElementString(v);
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -4798,7 +4801,7 @@ void DomUrl::write(QXmlStreamWriter &writer, const QString &tagName) const
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("url") : tagName.toLower());
if (m_children & String)
- m_string->write(writer, QStringLiteral("string"));
+ m_string->write(writer, u"string"_s);
writer.writeEndElement();
}
@@ -4911,196 +4914,196 @@ void DomProperty::read(QXmlStreamReader &reader)
const QXmlStreamAttributes &attributes = reader.attributes();
for (const QXmlStreamAttribute &attribute : attributes) {
const auto name = attribute.name();
- if (name == QLatin1String("name")) {
+ if (name == u"name"_s) {
setAttributeName(attribute.value().toString());
continue;
}
- if (name == QLatin1String("stdset")) {
+ if (name == u"stdset"_s) {
setAttributeStdset(attribute.value().toInt());
continue;
}
- reader.raiseError(QLatin1String("Unexpected attribute ") + name);
+ reader.raiseError("Unexpected attribute "_L1 + name);
}
while (!reader.hasError()) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- if (!tag.compare(QLatin1String("bool"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"bool"_s, Qt::CaseInsensitive)) {
setElementBool(reader.readElementText());
continue;
}
- if (!tag.compare(QLatin1String("color"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"color"_s, Qt::CaseInsensitive)) {
auto *v = new DomColor();
v->read(reader);
setElementColor(v);
continue;
}
- if (!tag.compare(QLatin1String("cstring"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"cstring"_s, Qt::CaseInsensitive)) {
setElementCstring(reader.readElementText());
continue;
}
- if (!tag.compare(QLatin1String("cursor"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"cursor"_s, Qt::CaseInsensitive)) {
setElementCursor(reader.readElementText().toInt());
continue;
}
- if (!tag.compare(QLatin1String("cursorshape"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"cursorshape"_s, Qt::CaseInsensitive)) {
setElementCursorShape(reader.readElementText());
continue;
}
- if (!tag.compare(QLatin1String("enum"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"enum"_s, Qt::CaseInsensitive)) {
setElementEnum(reader.readElementText());
continue;
}
- if (!tag.compare(QLatin1String("font"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"font"_s, Qt::CaseInsensitive)) {
auto *v = new DomFont();
v->read(reader);
setElementFont(v);
continue;
}
- if (!tag.compare(QLatin1String("iconset"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"iconset"_s, Qt::CaseInsensitive)) {
auto *v = new DomResourceIcon();
v->read(reader);
setElementIconSet(v);
continue;
}
- if (!tag.compare(QLatin1String("pixmap"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"pixmap"_s, Qt::CaseInsensitive)) {
auto *v = new DomResourcePixmap();
v->read(reader);
setElementPixmap(v);
continue;
}
- if (!tag.compare(QLatin1String("palette"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"palette"_s, Qt::CaseInsensitive)) {
auto *v = new DomPalette();
v->read(reader);
setElementPalette(v);
continue;
}
- if (!tag.compare(QLatin1String("point"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"point"_s, Qt::CaseInsensitive)) {
auto *v = new DomPoint();
v->read(reader);
setElementPoint(v);
continue;
}
- if (!tag.compare(QLatin1String("rect"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"rect"_s, Qt::CaseInsensitive)) {
auto *v = new DomRect();
v->read(reader);
setElementRect(v);
continue;
}
- if (!tag.compare(QLatin1String("set"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"set"_s, Qt::CaseInsensitive)) {
setElementSet(reader.readElementText());
continue;
}
- if (!tag.compare(QLatin1String("locale"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"locale"_s, Qt::CaseInsensitive)) {
auto *v = new DomLocale();
v->read(reader);
setElementLocale(v);
continue;
}
- if (!tag.compare(QLatin1String("sizepolicy"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"sizepolicy"_s, Qt::CaseInsensitive)) {
auto *v = new DomSizePolicy();
v->read(reader);
setElementSizePolicy(v);
continue;
}
- if (!tag.compare(QLatin1String("size"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"size"_s, Qt::CaseInsensitive)) {
auto *v = new DomSize();
v->read(reader);
setElementSize(v);
continue;
}
- if (!tag.compare(QLatin1String("string"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"string"_s, Qt::CaseInsensitive)) {
auto *v = new DomString();
v->read(reader);
setElementString(v);
continue;
}
- if (!tag.compare(QLatin1String("stringlist"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"stringlist"_s, Qt::CaseInsensitive)) {
auto *v = new DomStringList();
v->read(reader);
setElementStringList(v);
continue;
}
- if (!tag.compare(QLatin1String("number"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"number"_s, Qt::CaseInsensitive)) {
setElementNumber(reader.readElementText().toInt());
continue;
}
- if (!tag.compare(QLatin1String("float"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"float"_s, Qt::CaseInsensitive)) {
setElementFloat(reader.readElementText().toFloat());
continue;
}
- if (!tag.compare(QLatin1String("double"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"double"_s, Qt::CaseInsensitive)) {
setElementDouble(reader.readElementText().toDouble());
continue;
}
- if (!tag.compare(QLatin1String("date"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"date"_s, Qt::CaseInsensitive)) {
auto *v = new DomDate();
v->read(reader);
setElementDate(v);
continue;
}
- if (!tag.compare(QLatin1String("time"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"time"_s, Qt::CaseInsensitive)) {
auto *v = new DomTime();
v->read(reader);
setElementTime(v);
continue;
}
- if (!tag.compare(QLatin1String("datetime"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"datetime"_s, Qt::CaseInsensitive)) {
auto *v = new DomDateTime();
v->read(reader);
setElementDateTime(v);
continue;
}
- if (!tag.compare(QLatin1String("pointf"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"pointf"_s, Qt::CaseInsensitive)) {
auto *v = new DomPointF();
v->read(reader);
setElementPointF(v);
continue;
}
- if (!tag.compare(QLatin1String("rectf"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"rectf"_s, Qt::CaseInsensitive)) {
auto *v = new DomRectF();
v->read(reader);
setElementRectF(v);
continue;
}
- if (!tag.compare(QLatin1String("sizef"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"sizef"_s, Qt::CaseInsensitive)) {
auto *v = new DomSizeF();
v->read(reader);
setElementSizeF(v);
continue;
}
- if (!tag.compare(QLatin1String("longlong"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"longlong"_s, Qt::CaseInsensitive)) {
setElementLongLong(reader.readElementText().toLongLong());
continue;
}
- if (!tag.compare(QLatin1String("char"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"char"_s, Qt::CaseInsensitive)) {
auto *v = new DomChar();
v->read(reader);
setElementChar(v);
continue;
}
- if (!tag.compare(QLatin1String("url"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"url"_s, Qt::CaseInsensitive)) {
auto *v = new DomUrl();
v->read(reader);
setElementUrl(v);
continue;
}
- if (!tag.compare(QLatin1String("uint"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"uint"_s, Qt::CaseInsensitive)) {
setElementUInt(reader.readElementText().toUInt());
continue;
}
- if (!tag.compare(QLatin1String("ulonglong"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"ulonglong"_s, Qt::CaseInsensitive)) {
setElementULongLong(reader.readElementText().toULongLong());
continue;
}
- if (!tag.compare(QLatin1String("brush"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"brush"_s, Qt::CaseInsensitive)) {
auto *v = new DomBrush();
v->read(reader);
setElementBrush(v);
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -5116,163 +5119,163 @@ void DomProperty::write(QXmlStreamWriter &writer, const QString &tagName) const
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("property") : tagName.toLower());
if (hasAttributeName())
- writer.writeAttribute(QStringLiteral("name"), attributeName());
+ writer.writeAttribute(u"name"_s, attributeName());
if (hasAttributeStdset())
- writer.writeAttribute(QStringLiteral("stdset"), QString::number(attributeStdset()));
+ writer.writeAttribute(u"stdset"_s, QString::number(attributeStdset()));
switch (kind()) {
case Bool:
- writer.writeTextElement(QStringLiteral("bool"), elementBool());
+ writer.writeTextElement(u"bool"_s, elementBool());
break;
case Color:
if (m_color != nullptr)
- m_color->write(writer, QStringLiteral("color"));
+ m_color->write(writer, u"color"_s);
break;
case Cstring:
- writer.writeTextElement(QStringLiteral("cstring"), elementCstring());
+ writer.writeTextElement(u"cstring"_s, elementCstring());
break;
case Cursor:
- writer.writeTextElement(QStringLiteral("cursor"), QString::number(elementCursor()));
+ writer.writeTextElement(u"cursor"_s, QString::number(elementCursor()));
break;
case CursorShape:
- writer.writeTextElement(QStringLiteral("cursorShape"), elementCursorShape());
+ writer.writeTextElement(u"cursorShape"_s, elementCursorShape());
break;
case Enum:
- writer.writeTextElement(QStringLiteral("enum"), elementEnum());
+ writer.writeTextElement(u"enum"_s, elementEnum());
break;
case Font:
if (m_font != nullptr)
- m_font->write(writer, QStringLiteral("font"));
+ m_font->write(writer, u"font"_s);
break;
case IconSet:
if (m_iconSet != nullptr)
- m_iconSet->write(writer, QStringLiteral("iconset"));
+ m_iconSet->write(writer, u"iconset"_s);
break;
case Pixmap:
if (m_pixmap != nullptr)
- m_pixmap->write(writer, QStringLiteral("pixmap"));
+ m_pixmap->write(writer, u"pixmap"_s);
break;
case Palette:
if (m_palette != nullptr)
- m_palette->write(writer, QStringLiteral("palette"));
+ m_palette->write(writer, u"palette"_s);
break;
case Point:
if (m_point != nullptr)
- m_point->write(writer, QStringLiteral("point"));
+ m_point->write(writer, u"point"_s);
break;
case Rect:
if (m_rect != nullptr)
- m_rect->write(writer, QStringLiteral("rect"));
+ m_rect->write(writer, u"rect"_s);
break;
case Set:
- writer.writeTextElement(QStringLiteral("set"), elementSet());
+ writer.writeTextElement(u"set"_s, elementSet());
break;
case Locale:
if (m_locale != nullptr)
- m_locale->write(writer, QStringLiteral("locale"));
+ m_locale->write(writer, u"locale"_s);
break;
case SizePolicy:
if (m_sizePolicy != nullptr)
- m_sizePolicy->write(writer, QStringLiteral("sizepolicy"));
+ m_sizePolicy->write(writer, u"sizepolicy"_s);
break;
case Size:
if (m_size != nullptr)
- m_size->write(writer, QStringLiteral("size"));
+ m_size->write(writer, u"size"_s);
break;
case String:
if (m_string != nullptr)
- m_string->write(writer, QStringLiteral("string"));
+ m_string->write(writer, u"string"_s);
break;
case StringList:
if (m_stringList != nullptr)
- m_stringList->write(writer, QStringLiteral("stringlist"));
+ m_stringList->write(writer, u"stringlist"_s);
break;
case Number:
- writer.writeTextElement(QStringLiteral("number"), QString::number(elementNumber()));
+ writer.writeTextElement(u"number"_s, QString::number(elementNumber()));
break;
case Float:
- writer.writeTextElement(QStringLiteral("float"), QString::number(elementFloat(), 'f', 8));
+ writer.writeTextElement(u"float"_s, QString::number(elementFloat(), 'f', 8));
break;
case Double:
- writer.writeTextElement(QStringLiteral("double"), QString::number(elementDouble(), 'f', 15));
+ writer.writeTextElement(u"double"_s, QString::number(elementDouble(), 'f', 15));
break;
case Date:
if (m_date != nullptr)
- m_date->write(writer, QStringLiteral("date"));
+ m_date->write(writer, u"date"_s);
break;
case Time:
if (m_time != nullptr)
- m_time->write(writer, QStringLiteral("time"));
+ m_time->write(writer, u"time"_s);
break;
case DateTime:
if (m_dateTime != nullptr)
- m_dateTime->write(writer, QStringLiteral("datetime"));
+ m_dateTime->write(writer, u"datetime"_s);
break;
case PointF:
if (m_pointF != nullptr)
- m_pointF->write(writer, QStringLiteral("pointf"));
+ m_pointF->write(writer, u"pointf"_s);
break;
case RectF:
if (m_rectF != nullptr)
- m_rectF->write(writer, QStringLiteral("rectf"));
+ m_rectF->write(writer, u"rectf"_s);
break;
case SizeF:
if (m_sizeF != nullptr)
- m_sizeF->write(writer, QStringLiteral("sizef"));
+ m_sizeF->write(writer, u"sizef"_s);
break;
case LongLong:
- writer.writeTextElement(QStringLiteral("longLong"), QString::number(elementLongLong()));
+ writer.writeTextElement(u"longLong"_s, QString::number(elementLongLong()));
break;
case Char:
if (m_char != nullptr)
- m_char->write(writer, QStringLiteral("char"));
+ m_char->write(writer, u"char"_s);
break;
case Url:
if (m_url != nullptr)
- m_url->write(writer, QStringLiteral("url"));
+ m_url->write(writer, u"url"_s);
break;
case UInt:
- writer.writeTextElement(QStringLiteral("UInt"), QString::number(elementUInt()));
+ writer.writeTextElement(u"UInt"_s, QString::number(elementUInt()));
break;
case ULongLong:
- writer.writeTextElement(QStringLiteral("uLongLong"), QString::number(elementULongLong()));
+ writer.writeTextElement(u"uLongLong"_s, QString::number(elementULongLong()));
break;
case Brush:
if (m_brush != nullptr)
- m_brush->write(writer, QStringLiteral("brush"));
+ m_brush->write(writer, u"brush"_s);
break;
default:
@@ -5671,13 +5674,13 @@ void DomConnections::read(QXmlStreamReader &reader)
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- if (!tag.compare(QLatin1String("connection"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"connection"_s, Qt::CaseInsensitive)) {
auto *v = new DomConnection();
v->read(reader);
m_connection.append(v);
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -5693,7 +5696,7 @@ void DomConnections::write(QXmlStreamWriter &writer, const QString &tagName) con
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("connections") : tagName.toLower());
for (DomConnection *v : m_connection)
- v->write(writer, QStringLiteral("connection"));
+ v->write(writer, u"connection"_s);
writer.writeEndElement();
}
@@ -5715,29 +5718,29 @@ void DomConnection::read(QXmlStreamReader &reader)
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- if (!tag.compare(QLatin1String("sender"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"sender"_s, Qt::CaseInsensitive)) {
setElementSender(reader.readElementText());
continue;
}
- if (!tag.compare(QLatin1String("signal"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"signal"_s, Qt::CaseInsensitive)) {
setElementSignal(reader.readElementText());
continue;
}
- if (!tag.compare(QLatin1String("receiver"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"receiver"_s, Qt::CaseInsensitive)) {
setElementReceiver(reader.readElementText());
continue;
}
- if (!tag.compare(QLatin1String("slot"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"slot"_s, Qt::CaseInsensitive)) {
setElementSlot(reader.readElementText());
continue;
}
- if (!tag.compare(QLatin1String("hints"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"hints"_s, Qt::CaseInsensitive)) {
auto *v = new DomConnectionHints();
v->read(reader);
setElementHints(v);
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -5753,19 +5756,19 @@ void DomConnection::write(QXmlStreamWriter &writer, const QString &tagName) cons
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("connection") : tagName.toLower());
if (m_children & Sender)
- writer.writeTextElement(QStringLiteral("sender"), m_sender);
+ writer.writeTextElement(u"sender"_s, m_sender);
if (m_children & Signal)
- writer.writeTextElement(QStringLiteral("signal"), m_signal);
+ writer.writeTextElement(u"signal"_s, m_signal);
if (m_children & Receiver)
- writer.writeTextElement(QStringLiteral("receiver"), m_receiver);
+ writer.writeTextElement(u"receiver"_s, m_receiver);
if (m_children & Slot)
- writer.writeTextElement(QStringLiteral("slot"), m_slot);
+ writer.writeTextElement(u"slot"_s, m_slot);
if (m_children & Hints)
- m_hints->write(writer, QStringLiteral("hints"));
+ m_hints->write(writer, u"hints"_s);
writer.writeEndElement();
}
@@ -5848,13 +5851,13 @@ void DomConnectionHints::read(QXmlStreamReader &reader)
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- if (!tag.compare(QLatin1String("hint"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"hint"_s, Qt::CaseInsensitive)) {
auto *v = new DomConnectionHint();
v->read(reader);
m_hint.append(v);
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -5870,7 +5873,7 @@ void DomConnectionHints::write(QXmlStreamWriter &writer, const QString &tagName)
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("connectionhints") : tagName.toLower());
for (DomConnectionHint *v : m_hint)
- v->write(writer, QStringLiteral("hint"));
+ v->write(writer, u"hint"_s);
writer.writeEndElement();
}
@@ -5888,26 +5891,26 @@ void DomConnectionHint::read(QXmlStreamReader &reader)
const QXmlStreamAttributes &attributes = reader.attributes();
for (const QXmlStreamAttribute &attribute : attributes) {
const auto name = attribute.name();
- if (name == QLatin1String("type")) {
+ if (name == u"type"_s) {
setAttributeType(attribute.value().toString());
continue;
}
- reader.raiseError(QLatin1String("Unexpected attribute ") + name);
+ reader.raiseError("Unexpected attribute "_L1 + name);
}
while (!reader.hasError()) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- if (!tag.compare(QLatin1String("x"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"x"_s, Qt::CaseInsensitive)) {
setElementX(reader.readElementText().toInt());
continue;
}
- if (!tag.compare(QLatin1String("y"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"y"_s, Qt::CaseInsensitive)) {
setElementY(reader.readElementText().toInt());
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -5923,13 +5926,13 @@ void DomConnectionHint::write(QXmlStreamWriter &writer, const QString &tagName)
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("connectionhint") : tagName.toLower());
if (hasAttributeType())
- writer.writeAttribute(QStringLiteral("type"), attributeType());
+ writer.writeAttribute(u"type"_s, attributeType());
if (m_children & X)
- writer.writeTextElement(QString(QLatin1Char('x')), QString::number(m_x));
+ writer.writeTextElement(u"x"_s, QString::number(m_x));
if (m_children & Y)
- writer.writeTextElement(QString(QLatin1Char('y')), QString::number(m_y));
+ writer.writeTextElement(u"y"_s, QString::number(m_y));
writer.writeEndElement();
}
@@ -5968,13 +5971,13 @@ void DomDesignerData::read(QXmlStreamReader &reader)
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- if (!tag.compare(QLatin1String("property"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"property"_s, Qt::CaseInsensitive)) {
auto *v = new DomProperty();
v->read(reader);
m_property.append(v);
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -5990,7 +5993,7 @@ void DomDesignerData::write(QXmlStreamWriter &writer, const QString &tagName) co
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("designerdata") : tagName.toLower());
for (DomProperty *v : m_property)
- v->write(writer, QStringLiteral("property"));
+ v->write(writer, u"property"_s);
writer.writeEndElement();
}
@@ -6013,15 +6016,15 @@ void DomSlots::read(QXmlStreamReader &reader)
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- if (!tag.compare(QLatin1String("signal"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"signal"_s, Qt::CaseInsensitive)) {
m_signal.append(reader.readElementText());
continue;
}
- if (!tag.compare(QLatin1String("slot"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"slot"_s, Qt::CaseInsensitive)) {
m_slot.append(reader.readElementText());
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -6037,10 +6040,10 @@ void DomSlots::write(QXmlStreamWriter &writer, const QString &tagName) const
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("slots") : tagName.toLower());
for (const QString &v : m_signal)
- writer.writeTextElement(QStringLiteral("signal"), v);
+ writer.writeTextElement(u"signal"_s, v);
for (const QString &v : m_slot)
- writer.writeTextElement(QStringLiteral("slot"), v);
+ writer.writeTextElement(u"slot"_s, v);
writer.writeEndElement();
}
@@ -6071,19 +6074,19 @@ void DomPropertySpecifications::read(QXmlStreamReader &reader)
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- if (!tag.compare(QLatin1String("tooltip"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"tooltip"_s, Qt::CaseInsensitive)) {
auto *v = new DomPropertyToolTip();
v->read(reader);
m_tooltip.append(v);
continue;
}
- if (!tag.compare(QLatin1String("stringpropertyspecification"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"stringpropertyspecification"_s, Qt::CaseInsensitive)) {
auto *v = new DomStringPropertySpecification();
v->read(reader);
m_stringpropertyspecification.append(v);
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -6099,10 +6102,10 @@ void DomPropertySpecifications::write(QXmlStreamWriter &writer, const QString &t
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("propertyspecifications") : tagName.toLower());
for (DomPropertyToolTip *v : m_tooltip)
- v->write(writer, QStringLiteral("tooltip"));
+ v->write(writer, u"tooltip"_s);
for (DomStringPropertySpecification *v : m_stringpropertyspecification)
- v->write(writer, QStringLiteral("stringpropertyspecification"));
+ v->write(writer, u"stringpropertyspecification"_s);
writer.writeEndElement();
}
@@ -6126,18 +6129,18 @@ void DomPropertyToolTip::read(QXmlStreamReader &reader)
const QXmlStreamAttributes &attributes = reader.attributes();
for (const QXmlStreamAttribute &attribute : attributes) {
const auto name = attribute.name();
- if (name == QLatin1String("name")) {
+ if (name == u"name"_s) {
setAttributeName(attribute.value().toString());
continue;
}
- reader.raiseError(QLatin1String("Unexpected attribute ") + name);
+ reader.raiseError("Unexpected attribute "_L1 + name);
}
while (!reader.hasError()) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -6153,7 +6156,7 @@ void DomPropertyToolTip::write(QXmlStreamWriter &writer, const QString &tagName)
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("propertytooltip") : tagName.toLower());
if (hasAttributeName())
- writer.writeAttribute(QStringLiteral("name"), attributeName());
+ writer.writeAttribute(u"name"_s, attributeName());
writer.writeEndElement();
}
@@ -6165,26 +6168,26 @@ void DomStringPropertySpecification::read(QXmlStreamReader &reader)
const QXmlStreamAttributes &attributes = reader.attributes();
for (const QXmlStreamAttribute &attribute : attributes) {
const auto name = attribute.name();
- if (name == QLatin1String("name")) {
+ if (name == u"name"_s) {
setAttributeName(attribute.value().toString());
continue;
}
- if (name == QLatin1String("type")) {
+ if (name == u"type"_s) {
setAttributeType(attribute.value().toString());
continue;
}
- if (name == QLatin1String("notr")) {
+ if (name == u"notr"_s) {
setAttributeNotr(attribute.value().toString());
continue;
}
- reader.raiseError(QLatin1String("Unexpected attribute ") + name);
+ reader.raiseError("Unexpected attribute "_L1 + name);
}
while (!reader.hasError()) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -6200,13 +6203,13 @@ void DomStringPropertySpecification::write(QXmlStreamWriter &writer, const QStri
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("stringpropertyspecification") : tagName.toLower());
if (hasAttributeName())
- writer.writeAttribute(QStringLiteral("name"), attributeName());
+ writer.writeAttribute(u"name"_s, attributeName());
if (hasAttributeType())
- writer.writeAttribute(QStringLiteral("type"), attributeType());
+ writer.writeAttribute(u"type"_s, attributeType());
if (hasAttributeNotr())
- writer.writeAttribute(QStringLiteral("notr"), attributeNotr());
+ writer.writeAttribute(u"notr"_s, attributeNotr());
writer.writeEndElement();
}
diff --git a/src/designer/src/lib/uilib/ui4_p.h b/src/designer/src/lib/uilib/ui4_p.h
index 531f53abd..9f4816ec8 100644
--- a/src/designer/src/lib/uilib/ui4_p.h
+++ b/src/designer/src/lib/uilib/ui4_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 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:LGPL$
-** 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 Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** 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-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
//
// W A R N I N G
@@ -1681,6 +1645,16 @@ public:
inline bool hasElementKerning() const { return m_children & Kerning; }
void clearElementKerning();
+ inline QString elementHintingPreference() const { return m_hintingPreference; }
+ void setElementHintingPreference(const QString &a);
+ inline bool hasElementHintingPreference() const { return m_children & HintingPreference; }
+ void clearElementHintingPreference();
+
+ inline QString elementFontWeight() const { return m_fontWeight; }
+ void setElementFontWeight(const QString &a);
+ inline bool hasElementFontWeight() const { return m_children & FontWeight; }
+ void clearElementFontWeight();
+
private:
// child element data
@@ -1695,6 +1669,8 @@ private:
bool m_antialiasing = false;
QString m_styleStrategy;
bool m_kerning = false;
+ QString m_hintingPreference;
+ QString m_fontWeight;
enum Child {
Family = 1,
@@ -1706,7 +1682,9 @@ private:
StrikeOut = 64,
Antialiasing = 128,
StyleStrategy = 256,
- Kerning = 512
+ Kerning = 512,
+ HintingPreference = 1024,
+ FontWeight = 2048
};
};
diff --git a/src/designer/src/lib/uilib/uilib_global.h b/src/designer/src/lib/uilib/uilib_global.h
index 8630b0af0..be40d96dd 100644
--- a/src/designer/src/lib/uilib/uilib_global.h
+++ b/src/designer/src/lib/uilib/uilib_global.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** 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-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef UILIB_GLOBAL_H
#define UILIB_GLOBAL_H
diff --git a/src/designer/src/lib/uilib/widgets.table b/src/designer/src/lib/uilib/widgets.table
index 546197ebc..d1f9bea9d 100644
--- a/src/designer/src/lib/uilib/widgets.table
+++ b/src/designer/src/lib/uilib/widgets.table
@@ -27,8 +27,12 @@ DECLARE_WIDGET(QFrame, "")
DECLARE_WIDGET(QGroupBox, "")
#endif
#if QT_CONFIG(scrollarea)
+DECLARE_WIDGET(QAbstractScrollArea, "")
DECLARE_WIDGET(QScrollArea, "")
#endif
+#if QT_CONFIG(abstractslider)
+DECLARE_WIDGET(QAbstractSlider, "")
+#endif
#if QT_CONFIG(lcdnumber)
DECLARE_WIDGET(QLCDNumber, "")
#endif
@@ -73,6 +77,7 @@ DECLARE_WIDGET(QScrollBar, "")
DECLARE_WIDGET(QSlider, "")
#endif
#if QT_CONFIG(spinbox)
+DECLARE_WIDGET(QAbstractSpinBox, "")
DECLARE_WIDGET(QSpinBox, "")
DECLARE_WIDGET(QDoubleSpinBox, "")
#endif