diff --git a/src/Gui/PythonWrapper.cpp b/src/Gui/PythonWrapper.cpp index 2fc77b08c5..d5b9714296 100644 --- a/src/Gui/PythonWrapper.cpp +++ b/src/Gui/PythonWrapper.cpp @@ -672,7 +672,12 @@ Py::Object PythonWrapper::fromQObject(QObject* object, const char* className) throw Py::RuntimeError("Failed to wrap object"); #else // Access shiboken/PySide via Python - return qt_wrapInstance(object, className, "QtCore", "wrapInstance"); + std::string typeName; + if (className) + typeName = className; + else + typeName = object->metaObject()->className(); + return qt_wrapInstance(object, typeName, "QtCore", "wrapInstance"); #endif } @@ -694,7 +699,12 @@ Py::Object PythonWrapper::fromQWidget(QWidget* widget, const char* className) throw Py::RuntimeError("Failed to wrap widget"); #else // Access shiboken/PySide via Python - return qt_wrapInstance(widget, className, "QtWidgets", "wrapInstance"); + std::string typeName; + if (className) + typeName = className; + else + typeName = widget->metaObject()->className(); + return qt_wrapInstance(widget, typeName, "QtWidgets", "wrapInstance"); #endif }