diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2020-09-18 10:09:16 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2020-09-18 15:04:46 +0200 |
commit | d1fb46645309780437743052159468f743e28d68 (patch) | |
tree | 465ca79619068b82d099bed2c3c5d5332428ba89 /sources/shiboken2/generator/shiboken2/cppgenerator.cpp | |
parent | dc7acd1f2dc750c3c8602203ae1558b0e60a3c17 (diff) |
shiboken2: Add attribute for generating "using namespace"
Make it possible to turn off the generation of
using namespace. This is required in Qt 6 to avoid
a clash between Qt3DCore::QBuffer and QBuffer used
in __repr__.
Task-number: PYSIDE-1339
Task-number: PYSIDE-904
Change-Id: Iaaf3e67f0ffaae86e2de82b9a1b8fe7d00c74e6b
Reviewed-by: Christian Tismer <tismer@stackless.com>
Diffstat (limited to 'sources/shiboken2/generator/shiboken2/cppgenerator.cpp')
-rw-r--r-- | sources/shiboken2/generator/shiboken2/cppgenerator.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/sources/shiboken2/generator/shiboken2/cppgenerator.cpp b/sources/shiboken2/generator/shiboken2/cppgenerator.cpp index d38463e2c..7a4f59cf3 100644 --- a/sources/shiboken2/generator/shiboken2/cppgenerator.cpp +++ b/sources/shiboken2/generator/shiboken2/cppgenerator.cpp @@ -404,8 +404,9 @@ void CppGenerator::generateClass(QTextStream &s, const GeneratorContext &classCo { const AbstractMetaClass *context = metaClass->enclosingClass(); while (context) { - if (context->isNamespace() && !context->enclosingClass()) { - s << "using namespace " << context->qualifiedCppName() << ";\n"; + if (context->isNamespace() && !context->enclosingClass() + && static_cast<const NamespaceTypeEntry *>(context->typeEntry())->generateUsing()) { + s << "\nusing namespace " << context->qualifiedCppName() << ";\n"; break; } context = context->enclosingClass(); |