diff options
| author | Christian Tismer <tismer@stackless.com> | 2023-10-20 13:04:13 +0200 |
|---|---|---|
| committer | Christian Tismer <tismer@stackless.com> | 2023-10-25 10:45:54 +0200 |
| commit | d74dca257111f82a7eb661791dafd360c3225bac (patch) | |
| tree | 97e990f5e2584f552c160a21bba2712006a28ec7 /sources/pyside6/PySide6/QtQml/pysideqmlvolatilebool.cpp | |
| parent | 897eaa60525099f2c3667148955732db7fed7271 (diff) | |
shiboken: Unify the structure of type creation functions
It is the better concept to use the same structure for
all type creation functions. We move the type slots and
type specs into these functions.
The calling function then always has the same structure
of one static expression and returning the type.
This might also save some space for shatic structures.
Task-number: PYSIDE-2230
Change-Id: Ib972f210f44422eb1ebe47a0d92ac18a8377ac87
Pick-to: 6.6
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Diffstat (limited to 'sources/pyside6/PySide6/QtQml/pysideqmlvolatilebool.cpp')
| -rw-r--r-- | sources/pyside6/PySide6/QtQml/pysideqmlvolatilebool.cpp | 38 |
1 files changed, 22 insertions, 16 deletions
diff --git a/sources/pyside6/PySide6/QtQml/pysideqmlvolatilebool.cpp b/sources/pyside6/PySide6/QtQml/pysideqmlvolatilebool.cpp index d498f5bb0..e92e13aaf 100644 --- a/sources/pyside6/PySide6/QtQml/pysideqmlvolatilebool.cpp +++ b/sources/pyside6/PySide6/QtQml/pysideqmlvolatilebool.cpp @@ -113,25 +113,31 @@ QtQml_VolatileBoolObject_str(QtQml_VolatileBoolObject *self) return s; } -static PyType_Slot QtQml_VolatileBoolType_slots[] = { - {Py_tp_repr, reinterpret_cast<void *>(QtQml_VolatileBoolObject_repr)}, - {Py_tp_str, reinterpret_cast<void *>(QtQml_VolatileBoolObject_str)}, - {Py_tp_methods, reinterpret_cast<void *>(QtQml_VolatileBoolObject_methods)}, - {Py_tp_new, reinterpret_cast<void *>(QtQml_VolatileBoolObject_new)}, - {Py_tp_dealloc, reinterpret_cast<void *>(QtQml_VolatileBoolObject_dealloc)}, - {0, 0} -}; -static PyType_Spec QtQml_VolatileBoolType_spec = { - "2:PySide6.QtQml.VolatileBool", - sizeof(QtQml_VolatileBoolObject), - 0, - Py_TPFLAGS_DEFAULT, - QtQml_VolatileBoolType_slots, -}; +static PyTypeObject *createVolatileBoolType() +{ + PyType_Slot QtQml_VolatileBoolType_slots[] = { + {Py_tp_repr, reinterpret_cast<void *>(QtQml_VolatileBoolObject_repr)}, + {Py_tp_str, reinterpret_cast<void *>(QtQml_VolatileBoolObject_str)}, + {Py_tp_methods, reinterpret_cast<void *>(QtQml_VolatileBoolObject_methods)}, + {Py_tp_new, reinterpret_cast<void *>(QtQml_VolatileBoolObject_new)}, + {Py_tp_dealloc, reinterpret_cast<void *>(QtQml_VolatileBoolObject_dealloc)}, + {0, 0} + }; + + PyType_Spec QtQml_VolatileBoolType_spec = { + "2:PySide6.QtQml.VolatileBool", + sizeof(QtQml_VolatileBoolObject), + 0, + Py_TPFLAGS_DEFAULT, + QtQml_VolatileBoolType_slots, + }; + + return SbkType_FromSpec(&QtQml_VolatileBoolType_spec); +} PyTypeObject *QtQml_VolatileBool_TypeF(void) { - static auto *type = SbkType_FromSpec(&QtQml_VolatileBoolType_spec); + static auto *type = createVolatileBoolType(); return type; } |
