summaryrefslogtreecommitdiffstats
path: root/src/tools/uic/cpp/cppwritedeclaration.cpp
diff options
context:
space:
mode:
authorhjk <hjk@qt.io>2023-01-18 17:26:08 +0100
committerhjk <hjk@qt.io>2023-02-20 18:06:33 +0100
commit7b1ba955a6da3d4414fa206ec1c06c1fc6e16161 (patch)
tree1b9602f27e8ef3fa6effd858c1d145e36f4165b4 /src/tools/uic/cpp/cppwritedeclaration.cpp
parentb74db90be055904c43953695e51b216100de71bb (diff)
uic: Add a -no-qt-namespace option
To suppress the generation of the Ui class within QT_BEGIN_NAMESPACE and QT_END_NAMESPACE. Change-Id: I6552b41d8e9eccb0475618d7ed7f7cea7f826625 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Diffstat (limited to 'src/tools/uic/cpp/cppwritedeclaration.cpp')
-rw-r--r--src/tools/uic/cpp/cppwritedeclaration.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/tools/uic/cpp/cppwritedeclaration.cpp b/src/tools/uic/cpp/cppwritedeclaration.cpp
index 910c4e2ee25..8261963cfaa 100644
--- a/src/tools/uic/cpp/cppwritedeclaration.cpp
+++ b/src/tools/uic/cpp/cppwritedeclaration.cpp
@@ -65,8 +65,8 @@ 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.size() == 0
- || namespaceList[0] == "qdesigner_internal"_L1;
+ const bool needsMacro = m_option.qtNamespace &&
+ (namespaceList.size() == 0 || namespaceList[0] == "qdesigner_internal"_L1);
if (needsMacro)
m_output << "QT_BEGIN_NAMESPACE\n\n";