diff options
Diffstat (limited to 'sources/shiboken2/generator/generator.cpp')
-rw-r--r-- | sources/shiboken2/generator/generator.cpp | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/sources/shiboken2/generator/generator.cpp b/sources/shiboken2/generator/generator.cpp index f90cd312f..60282828a 100644 --- a/sources/shiboken2/generator/generator.cpp +++ b/sources/shiboken2/generator/generator.cpp @@ -43,6 +43,8 @@ #include <QDebug> #include <typedatabase.h> +static const char ENABLE_PYSIDE_EXTENSIONS[] = "enable-pyside-extensions"; + /** * DefaultValue is used for storing default values of types for which code is * generated in different contexts: @@ -169,6 +171,7 @@ struct Generator::GeneratorPrivate QVector<const AbstractMetaType *> instantiatedContainers; QVector<const AbstractMetaType *> instantiatedSmartPointers; AbstractMetaClassList m_invisibleTopNamespaces; + bool m_usePySideExtensions = false; }; Generator::Generator() : m_d(new GeneratorPrivate) @@ -339,11 +342,17 @@ QVector<const AbstractMetaType *> Generator::instantiatedSmartPointers() const Generator::OptionDescriptions Generator::options() const { - return OptionDescriptions(); + return { + {QLatin1String(ENABLE_PYSIDE_EXTENSIONS), + QLatin1String("Enable PySide extensions, such as support for signal/slots,\n" + "use this if you are creating a binding for a Qt-based library.")} + }; } -bool Generator::handleOption(const QString & /* key */, const QString & /* value */) +bool Generator::handleOption(const QString & key, const QString & /* value */) { + if (key == QLatin1String(ENABLE_PYSIDE_EXTENSIONS)) + return ( m_d->m_usePySideExtensions = true); return false; } @@ -615,6 +624,11 @@ bool Generator::isVoidPointer(const AbstractMetaType *type) && type->name() == QLatin1String("void"); } +bool Generator::usePySideExtensions() const +{ + return m_d->m_usePySideExtensions; +} + QString Generator::getFullTypeName(const TypeEntry *type) const { QString result = type->qualifiedCppName(); |