Gui: PythonWrapper: Make qt_getCppType more robust

Handle gracefully possible shiboken's Python API changes.
This commit is contained in:
wmayer
2024-03-02 22:54:32 +01:00
committed by wwmayer
parent 3d2c365093
commit d4c564efe9

View File

@@ -471,6 +471,9 @@ qttype* qt_getCppType(PyObject* pyobj)
// https://github.com/PySide/Shiboken/blob/master/shibokenmodule/typesystem_shiboken.xml
Py::Module mainmod(importShiboken(), true);
Py::Callable func = mainmod.getDict().getItem("getCppPointer");
if (func.isNull()) {
throw Py::RuntimeError("Failed to get C++ pointer");
}
Py::Tuple arguments(1);
arguments[0] = Py::Object(pyobj); // PySide pointer