aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside6/PySide6
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2021-09-10 11:29:19 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2021-09-11 08:36:40 +0000
commita4311711eb89e3f9833a05edf3debdf7563a104f (patch)
tree257a50545359f81f7c17437003dc70f4ba74b835 /sources/pyside6/PySide6
parent327cd3aa4da7d4a9c4ce593751fd3e385abba3f0 (diff)
Define SbkObjectType to be a PyTypeObject
SbkObjectType was a struct embedding a PyTypeObject after fec1611e9f42c1f0a13eb33474df2ed8ee480842. Remove that and make the types equvivalent, which allows for removing many reinterpret_casts. SbkObjectType is left as a typedef for client code snippets. [ChangeLog][shiboken6] SbkObjectType is now a typedef for PyTypeObject. Task-number: PYSIDE-535 Change-Id: I44812311ccbbe0988c38e34c47d16f6874f8d1cf Reviewed-by: Christian Tismer <tismer@stackless.com>
Diffstat (limited to 'sources/pyside6/PySide6')
-rw-r--r--sources/pyside6/PySide6/QtQml/pysideqmlregistertype.h2
-rw-r--r--sources/pyside6/PySide6/QtQuick/pysidequickregistertype.h2
-rw-r--r--sources/pyside6/PySide6/glue/qtcore.cpp7
-rw-r--r--sources/pyside6/PySide6/glue/qtwidgets.cpp2
4 files changed, 4 insertions, 9 deletions
diff --git a/sources/pyside6/PySide6/QtQml/pysideqmlregistertype.h b/sources/pyside6/PySide6/QtQml/pysideqmlregistertype.h
index 2a90a07e0..0dbfb6e5a 100644
--- a/sources/pyside6/PySide6/QtQml/pysideqmlregistertype.h
+++ b/sources/pyside6/PySide6/QtQml/pysideqmlregistertype.h
@@ -42,8 +42,6 @@
#include <sbkpython.h>
-struct SbkObjectType;
-
namespace PySide
{
diff --git a/sources/pyside6/PySide6/QtQuick/pysidequickregistertype.h b/sources/pyside6/PySide6/QtQuick/pysidequickregistertype.h
index 1955413b2..ee4b60866 100644
--- a/sources/pyside6/PySide6/QtQuick/pysidequickregistertype.h
+++ b/sources/pyside6/PySide6/QtQuick/pysidequickregistertype.h
@@ -42,8 +42,6 @@
#include <sbkpython.h>
-struct SbkObjectType;
-
namespace PySide
{
void initQuickSupport(PyObject *module);
diff --git a/sources/pyside6/PySide6/glue/qtcore.cpp b/sources/pyside6/PySide6/glue/qtcore.cpp
index d749c17c1..ad5eb447f 100644
--- a/sources/pyside6/PySide6/glue/qtcore.cpp
+++ b/sources/pyside6/PySide6/glue/qtcore.cpp
@@ -150,8 +150,7 @@ return %out;
static QMetaType QVariant_resolveMetaType(PyTypeObject *type)
{
if (PyObject_TypeCheck(type, SbkObjectType_TypeF())) {
- auto sbkType = reinterpret_cast<SbkObjectType *>(type);
- const char *typeName = Shiboken::ObjectType::getOriginalName(sbkType);
+ const char *typeName = Shiboken::ObjectType::getOriginalName(type);
if (!typeName)
return {};
const bool valueType = '*' != typeName[qstrlen(typeName) - 1];
@@ -1316,7 +1315,7 @@ auto *ptr = reinterpret_cast<uchar *>(Shiboken::Buffer::getPointer(%PYARG_1, &si
// %FUNCTION_NAME() - disable generation of c++ function call
(void) %2; // remove warning about unused variable
Shiboken::AutoDecRef emptyTuple(PyTuple_New(0));
-auto *timerType = reinterpret_cast<PyTypeObject *>(Shiboken::SbkType<QTimer>());
+auto *timerType = Shiboken::SbkType<QTimer>();
auto *pyTimer = timerType->tp_new(Shiboken::SbkType<QTimer>(), emptyTuple, nullptr);
timerType->tp_init(pyTimer, emptyTuple, nullptr);
@@ -1339,7 +1338,7 @@ timer->start(%1);
// @snippet qtimer-singleshot-2
// %FUNCTION_NAME() - disable generation of c++ function call
Shiboken::AutoDecRef emptyTuple(PyTuple_New(0));
-auto *timerType = reinterpret_cast<PyTypeObject *>(Shiboken::SbkType<QTimer>());
+auto *timerType = Shiboken::SbkType<QTimer>();
auto *pyTimer = timerType->tp_new(Shiboken::SbkType<QTimer>(), emptyTuple, nullptr);
timerType->tp_init(pyTimer, emptyTuple, nullptr);
QTimer * timer = %CONVERTTOCPP[QTimer *](pyTimer);
diff --git a/sources/pyside6/PySide6/glue/qtwidgets.cpp b/sources/pyside6/PySide6/glue/qtwidgets.cpp
index d2b7872d4..802a3c172 100644
--- a/sources/pyside6/PySide6/glue/qtwidgets.cpp
+++ b/sources/pyside6/PySide6/glue/qtwidgets.cpp
@@ -56,7 +56,7 @@ Shiboken::Object::releaseOwnership(%PYARG_0);
// @snippet qgraphicsitem
PyObject *userTypeConstant = PyLong_FromLong(QGraphicsItem::UserType);
-PyDict_SetItemString(reinterpret_cast<PyTypeObject *>(Sbk_QGraphicsItem_TypeF())->tp_dict, "UserType", userTypeConstant);
+PyDict_SetItemString(Sbk_QGraphicsItem_TypeF()->tp_dict, "UserType", userTypeConstant);
// @snippet qgraphicsitem
// @snippet qgraphicsitem-scene-return-parenting