diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2019-07-11 11:29:38 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2019-07-29 12:57:31 +0200 |
commit | 5f72e0414f024822b5fe072e55f2a15a28332846 (patch) | |
tree | 3228aa8e95c68301d00f66c0073c4c529bf503cf /sources | |
parent | c3342a72cfe682f9a9731a8fc12e117282e30d42 (diff) |
shiboken: Allow for "auto" as target of type for CONVERTTOCPP in injected code
Task-number: PYSIDE-1037
Change-Id: Idfc70fe571e4058d0c82db1bd0afea54436fe27c
Reviewed-by: Christian Tismer <tismer@stackless.com>
Diffstat (limited to 'sources')
-rw-r--r-- | sources/pyside2/PySide2/glue/qtcore.cpp | 5 | ||||
-rw-r--r-- | sources/shiboken2/doc/typesystemvariables.rst | 2 | ||||
-rw-r--r-- | sources/shiboken2/generator/shiboken2/shibokengenerator.cpp | 2 |
3 files changed, 5 insertions, 4 deletions
diff --git a/sources/pyside2/PySide2/glue/qtcore.cpp b/sources/pyside2/PySide2/glue/qtcore.cpp index 3e1bab97b..93f7321aa 100644 --- a/sources/pyside2/PySide2/glue/qtcore.cpp +++ b/sources/pyside2/PySide2/glue/qtcore.cpp @@ -1289,7 +1289,7 @@ Shiboken::AutoDecRef emptyTuple(PyTuple_New(0)); PyObject *pyTimer = reinterpret_cast<PyTypeObject *>(Shiboken::SbkType<QTimer>())->tp_new(Shiboken::SbkType<QTimer>(), emptyTuple, 0); reinterpret_cast<PyTypeObject *>(Shiboken::SbkType<QTimer>())->tp_init(pyTimer, emptyTuple, 0); -QTimer * timer = %CONVERTTOCPP[QTimer *](pyTimer); +auto timer = %CONVERTTOCPP[QTimer *](pyTimer); //XXX /|\ omitting this space crashes shiboken! Shiboken::AutoDecRef result( PyObject_CallMethod(pyTimer, @@ -1484,8 +1484,7 @@ if (PySide::SignalManager::registerMetaMethod(%1, signalName.mid(1).toLatin1().d if (!PyObject_TypeCheck(%1, PySideSignalInstanceTypeF())) goto Sbk_%TYPEFunc_%FUNCTION_NAME_TypeError; PySideSignalInstance *signalInstance = reinterpret_cast<PySideSignalInstance *>(%1); -QObject * sender = %CONVERTTOCPP[QObject *](PySide::Signal::getObject(signalInstance)); -//XXX /|\ omitting this space crashes shiboken! +auto sender = %CONVERTTOCPP[QObject *](PySide::Signal::getObject(signalInstance)); QSignalTransition *%0 = %CPPSELF->%FUNCTION_NAME(sender, PySide::Signal::getSignature(signalInstance),%2); %PYARG_0 = %CONVERTTOPYTHON[QSignalTransition *](%0); // @snippet qstate-addtransition-2 diff --git a/sources/shiboken2/doc/typesystemvariables.rst b/sources/shiboken2/doc/typesystemvariables.rst index b1b9bbfe6..73d4dd12c 100644 --- a/sources/shiboken2/doc/typesystemvariables.rst +++ b/sources/shiboken2/doc/typesystemvariables.rst @@ -150,6 +150,8 @@ Variables since it otherwise would be indistinguishable from the pointer assignment above. + It is possible to use "auto" as type. + .. _converttopython: **%CONVERTTOPYTHON[CPPTYPE]** diff --git a/sources/shiboken2/generator/shiboken2/shibokengenerator.cpp b/sources/shiboken2/generator/shiboken2/shibokengenerator.cpp index e41c91716..34e43a4c7 100644 --- a/sources/shiboken2/generator/shiboken2/shibokengenerator.cpp +++ b/sources/shiboken2/generator/shiboken2/shibokengenerator.cpp @@ -2047,7 +2047,7 @@ void ShibokenGenerator::replaceConverterTypeSystemVariable(TypeSystemConverterVa QString varName = list.at(1).trimmed(); if (!varType.isEmpty()) { const QString conversionSignature = conversionType->cppSignature(); - if (varType != conversionSignature) + if (varType != QLatin1String("auto") && varType != conversionSignature) qFatal("%s", qPrintable(msgConversionTypesDiffer(varType, conversionSignature))); c << getFullTypeName(conversionType) << ' ' << varName; writeMinimalConstructorExpression(c, conversionType); |