diff options
Diffstat (limited to 'src/tools/uic/cpp/cppwritedeclaration.cpp')
-rw-r--r-- | src/tools/uic/cpp/cppwritedeclaration.cpp | 55 |
1 files changed, 16 insertions, 39 deletions
diff --git a/src/tools/uic/cpp/cppwritedeclaration.cpp b/src/tools/uic/cpp/cppwritedeclaration.cpp index 995b99b692..8261963cfa 100644 --- a/src/tools/uic/cpp/cppwritedeclaration.cpp +++ b/src/tools/uic/cpp/cppwritedeclaration.cpp @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// 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 "cppwritedeclaration.h" #include "cppwriteinitialization.h" @@ -39,6 +14,8 @@ QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; + namespace { void openNameSpaces(const QStringList &namespaceList, QTextStream &output) { @@ -75,10 +52,10 @@ void WriteDeclaration::acceptUI(DomUI *node) QString exportMacro = node->elementExportMacro(); if (!exportMacro.isEmpty()) - exportMacro.append(QLatin1Char(' ')); + exportMacro.append(u' '); - QStringList namespaceList = qualifiedClassName.split(QLatin1String("::")); - if (namespaceList.count()) { + QStringList namespaceList = qualifiedClassName.split("::"_L1); + if (namespaceList.size()) { className = namespaceList.last(); namespaceList.removeLast(); } @@ -88,15 +65,15 @@ void WriteDeclaration::acceptUI(DomUI *node) // is a User using Qt-in-namespace having his own classes not in a namespace. // In this case the generated Ui helper classes will also end up in // the Qt namespace (which is harmless, but not "pretty") - const bool needsMacro = namespaceList.count() == 0 - || namespaceList[0] == QLatin1String("qdesigner_internal"); + const bool needsMacro = m_option.qtNamespace && + (namespaceList.size() == 0 || namespaceList[0] == "qdesigner_internal"_L1); if (needsMacro) m_output << "QT_BEGIN_NAMESPACE\n\n"; openNameSpaces(namespaceList, m_output); - if (namespaceList.count()) + if (namespaceList.size()) m_output << "\n"; m_output << "class " << exportMacro << m_option.prefix << className << "\n" @@ -105,7 +82,7 @@ void WriteDeclaration::acceptUI(DomUI *node) const QStringList connections = m_uic->databaseInfo()->connections(); for (const QString &connection : connections) { - if (connection != QLatin1String("(default)")) + if (connection != "(default)"_L1) m_output << m_option.indent << "QSqlDatabase " << connection << "Connection;\n"; } @@ -121,11 +98,11 @@ void WriteDeclaration::acceptUI(DomUI *node) closeNameSpaces(namespaceList, m_output); - if (namespaceList.count()) + if (namespaceList.size()) m_output << "\n"; if (m_option.generateNamespace && !m_option.prefix.isEmpty()) { - namespaceList.append(QLatin1String("Ui")); + namespaceList.append("Ui"_L1); openNameSpaces(namespaceList, m_output); @@ -133,7 +110,7 @@ void WriteDeclaration::acceptUI(DomUI *node) closeNameSpaces(namespaceList, m_output); - if (namespaceList.count()) + if (namespaceList.size()) m_output << "\n"; } @@ -143,7 +120,7 @@ void WriteDeclaration::acceptUI(DomUI *node) void WriteDeclaration::acceptWidget(DomWidget *node) { - QString className = QLatin1String("QWidget"); + QString className = u"QWidget"_s; if (node->hasAttributeClass()) className = node->attributeClass(); @@ -160,7 +137,7 @@ void WriteDeclaration::acceptSpacer(DomSpacer *node) void WriteDeclaration::acceptLayout(DomLayout *node) { - QString className = QLatin1String("QLayout"); + QString className = u"QLayout"_s; if (node->hasAttributeClass()) className = node->attributeClass(); |