diff options
| author | Christian Tismer <tismer@stackless.com> | 2023-06-15 15:50:31 +0200 |
|---|---|---|
| committer | Christian Tismer <tismer@stackless.com> | 2023-06-30 10:44:58 +0200 |
| commit | 895c452fd874fe4dfeb5a44e8c959136ceedba13 (patch) | |
| tree | 9638efb0bcef53a703efcd8e5906dc9a483a6edb /sources/pyside6/PySide6 | |
| parent | 4a09bcbeb4257c7decedf0b4eed1f9847c91c739 (diff) | |
PyEnum: Shortcut old Enum code and generate Python enums directly
The amalgamation of old and new enums is slowly unraveling from the
inside. This meanwhile actually removes the old code.
Included a change by Friedemann to improve enum value handling.
After the signed/unsigned problem was fixed, there was only one case
left where Qt and Clang parser disagreed which could be fixed.
The final solution uses overloaded functions to generate all
necessary cases with minimal footprint in the executable.
Task-number: PYSIDE-1735
Change-Id: I3741ce8621e783a750f3c05241c916008f78f39b
Done-with: Friedemann.Kleint@qt.io (+2 squashed commits)
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'sources/pyside6/PySide6')
| -rw-r--r-- | sources/pyside6/PySide6/QtCore/typesystem_core_common.xml | 1 | ||||
| -rw-r--r-- | sources/pyside6/PySide6/glue/qtcore.cpp | 8 | ||||
| -rw-r--r-- | sources/pyside6/PySide6/glue/qtgui.cpp | 5 |
3 files changed, 3 insertions, 11 deletions
diff --git a/sources/pyside6/PySide6/QtCore/typesystem_core_common.xml b/sources/pyside6/PySide6/QtCore/typesystem_core_common.xml index 646c2f311..b1557af87 100644 --- a/sources/pyside6/PySide6/QtCore/typesystem_core_common.xml +++ b/sources/pyside6/PySide6/QtCore/typesystem_core_common.xml @@ -268,7 +268,6 @@ <add-conversion type="QByteArray" file="../glue/qtcore.cpp" snippet="conversion-qbytearray"/> <add-conversion type="PyFloat" check="PyFloat_CheckExact(%in)" file="../glue/qtcore.cpp" snippet="conversion-pyfloat"/> <add-conversion type="PyLong" check="PyLong_CheckExact(%in)" file="../glue/qtcore.cpp" snippet="conversion-qlonglong"/> - <add-conversion type="SbkEnumType" file="../glue/qtcore.cpp" snippet="conversion-sbkobject"/> <add-conversion type="SbkObject" file="../glue/qtcore.cpp" snippet="conversion-sbkobject"/> <add-conversion type="PyDict" check="PyDict_CheckExact(%in)" file="../glue/qtcore.cpp" snippet="conversion-pydict"/> <add-conversion type="PyList" check="PyList_Check(%in)" file="../glue/qtcore.cpp" snippet="conversion-pylist"/> diff --git a/sources/pyside6/PySide6/glue/qtcore.cpp b/sources/pyside6/PySide6/glue/qtcore.cpp index ddb5a9ffa..f15fb6f8a 100644 --- a/sources/pyside6/PySide6/glue/qtcore.cpp +++ b/sources/pyside6/PySide6/glue/qtcore.cpp @@ -145,11 +145,7 @@ else { // @snippet metatype-from-type // @snippet metatype-from-metatype-type -Shiboken::AutoDecRef intArg; -if (usingNewEnum()) - intArg.reset(PyObject_GetAttrString(%PYARG_1, "value")); -else - intArg.reset(PyObject_CallMethod(%PYARG_1, "__int__", nullptr)); +Shiboken::AutoDecRef intArg(PyObject_GetAttrString(%PYARG_1, "value")); %0 = new %TYPE(PyLong_AsLong(intArg)); // @snippet metatype-from-metatype-type @@ -1187,7 +1183,7 @@ Py_END_ALLOW_THREADS if (atexit.isNull()) { qWarning("Module atexit not found for registering __moduleShutdown"); PyErr_Clear(); - }else{ + } else { regFunc.reset(PyObject_GetAttrString(atexit, "register")); if (regFunc.isNull()) { qWarning("Function atexit.register not found for registering __moduleShutdown"); diff --git a/sources/pyside6/PySide6/glue/qtgui.cpp b/sources/pyside6/PySide6/glue/qtgui.cpp index d610933ba..38e01f24c 100644 --- a/sources/pyside6/PySide6/glue/qtgui.cpp +++ b/sources/pyside6/PySide6/glue/qtgui.cpp @@ -313,10 +313,7 @@ if (_i < 0 || _i >= %CPPSELF.count()) { return 0; } QKeyCombination item = (*%CPPSELF)[_i]; -if (usingNewEnum()) - return %CONVERTTOPYTHON[QKeyCombination](item); -auto combined = item.toCombined(); -return %CONVERTTOPYTHON[int](combined); +return %CONVERTTOPYTHON[QKeyCombination](item); // @snippet qkeysequence-getitem // @snippet qkeysequence-repr |
