summaryrefslogtreecommitdiffstats
path: root/src/designer/src/lib/shared/qsimpleresource.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/designer/src/lib/shared/qsimpleresource.cpp')
-rw-r--r--src/designer/src/lib/shared/qsimpleresource.cpp47
1 files changed, 11 insertions, 36 deletions
diff --git a/src/designer/src/lib/shared/qsimpleresource.cpp b/src/designer/src/lib/shared/qsimpleresource.cpp
index eca53c216..2b0ef4a07 100644
--- a/src/designer/src/lib/shared/qsimpleresource.cpp
+++ b/src/designer/src/lib/shared/qsimpleresource.cpp
@@ -1,34 +1,10 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 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:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "qsimpleresource_p.h"
#include "widgetfactory_p.h"
#include "widgetdatabase_p.h"
+#include <qdesigner_utils_p.h>
#include <QtDesigner/private/properties_p.h>
#include <QtDesigner/private/ui4_p.h>
@@ -50,6 +26,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
namespace qdesigner_internal {
bool QSimpleResource::m_warningsEnabled = true;
@@ -58,10 +36,7 @@ QSimpleResource::QSimpleResource(QDesignerFormEditorInterface *core) :
QAbstractFormBuilder(),
m_core(core)
{
- QString workingDirectory = QDir::homePath();
- workingDirectory += QDir::separator();
- workingDirectory += QStringLiteral(".designer");
- setWorkingDirectory(QDir(workingDirectory));
+ setWorkingDirectory(QDir(dataDirectory()));
}
QSimpleResource::~QSimpleResource() = default;
@@ -160,16 +135,16 @@ void QSimpleResource::addCustomWidgetsToWidgetDatabase(const QDesignerFormEditor
QList<DomCustomWidget *> &custom_widget_list)
{
QDesignerWidgetDataBaseInterface *db = core->widgetDataBase();
- for (int i=0; i < custom_widget_list.size(); ) {
+ for (qsizetype i = 0; i < custom_widget_list.size(); ) {
bool classInserted = false;
- DomCustomWidget *custom_widget = custom_widget_list[i];
+ DomCustomWidget *custom_widget = custom_widget_list.at(i);
const QString customClassName = custom_widget->elementClass();
const QString base_class = custom_widget->elementExtends();
QString includeFile;
IncludeType includeType = IncludeLocal;
if (const DomHeader *header = custom_widget->elementHeader()) {
includeFile = header->text();
- if (header->hasAttributeLocation() && header->attributeLocation() == QStringLiteral("global"))
+ if (header->hasAttributeLocation() && header->attributeLocation() == "global"_L1)
includeType = IncludeGlobal;
}
const bool domIsContainer = custom_widget->elementContainer();
@@ -230,8 +205,8 @@ void QSimpleResource::handleDomCustomWidgets(const QDesignerFormEditorInterface
}
// Oops, there are classes left whose base class could not be found.
// Default them to QWidget with warnings.
- const QString fallBackBaseClass = QStringLiteral("QWidget");
- for (DomCustomWidget *custom_widget : qAsConst(custom_widget_list)) {
+ const QString fallBackBaseClass = u"QWidget"_s;
+ for (DomCustomWidget *custom_widget : std::as_const(custom_widget_list)) {
const QString customClassName = custom_widget->elementClass();
const QString base_class = custom_widget->elementExtends();
qDebug() << "** WARNING The base class " << base_class << " of the custom widget class " << customClassName