diff --git a/src/Gui/PythonWrapper.cpp b/src/Gui/PythonWrapper.cpp index a2ea77cffc36..9d2c4af5a717 100644 --- a/src/Gui/PythonWrapper.cpp +++ b/src/Gui/PythonWrapper.cpp @@ -677,7 +677,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 } @@ -699,7 +704,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 }