aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken2/generator
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2020-09-14 10:37:10 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2020-09-16 14:59:36 +0200
commitb6eaa63a81654459827851a261ad50829cc511ba (patch)
treec72b3afbe93e4897be5381ec5e1d3f294cef9e8c /sources/shiboken2/generator
parentdedbc42b569d0dc25de10712168b99d0844c8e50 (diff)
Remove dependency of the QtQml module header on pysideqmlregistertype.h
Make it possible to inject code into module headers by specifying "declaration" on type system code snippets. Use that to insert the struct definition into pyside2_qtqml_python.h and remove the include. Add the required includes via code injection into the wrapper and extra includes for the types. Fixes: PYSIDE-1381 Change-Id: I8dfda4c33d66f56e8fb516e1b174cc43664ca318 Reviewed-by: Christian Tismer <tismer@stackless.com>
Diffstat (limited to 'sources/shiboken2/generator')
-rw-r--r--sources/shiboken2/generator/shiboken2/headergenerator.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/sources/shiboken2/generator/shiboken2/headergenerator.cpp b/sources/shiboken2/generator/shiboken2/headergenerator.cpp
index 8b3fe1653..cd99d76be 100644
--- a/sources/shiboken2/generator/shiboken2/headergenerator.cpp
+++ b/sources/shiboken2/generator/shiboken2/headergenerator.cpp
@@ -391,6 +391,12 @@ bool HeaderGenerator::finishGeneration()
QString protectedEnumSurrogates;
QTextStream protEnumsSurrogates(&protectedEnumSurrogates);
+ const auto snips = TypeDatabase::instance()->defaultTypeSystemType()->codeSnips();
+ if (!snips.isEmpty()) {
+ writeCodeSnips(macrosStream, snips, TypeSystem::CodeSnipPositionDeclaration,
+ TypeSystem::TargetLangCode);
+ }
+
Indentation indent(INDENT);
macrosStream << "// Type indices\nenum : int {\n";