Skip to content

Commit

Permalink
code simplification in PythonWrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
wwmayer committed Jun 22, 2019
1 parent 60fd668 commit 3eaf87b
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions src/Gui/WidgetFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -503,11 +503,8 @@ void PythonWrapper::createChildrenNameAttributes(PyObject* root, QObject* object
if (!name.isEmpty() && !name.startsWith("_") && !name.startsWith("qt_")) {
bool hasAttr = PyObject_HasAttrString(root, name.constData());
if (!hasAttr) {
#if defined (HAVE_SHIBOKEN2) && defined(HAVE_PYSIDE2)
Shiboken::AutoDecRef pyChild(Shiboken::Conversions::pointerToPython((SbkObjectType*)SbkPySide2_QtCoreTypes[SBK_QOBJECT_IDX], child));
PyObject_SetAttrString(root, name.constData(), pyChild);
#elif defined (HAVE_SHIBOKEN) && defined(HAVE_PYSIDE)
Shiboken::AutoDecRef pyChild(Shiboken::Conversions::pointerToPython((SbkObjectType*)SbkPySide_QtCoreTypes[SBK_QOBJECT_IDX], child));
#if defined (HAVE_SHIBOKEN) && defined(HAVE_PYSIDE)
Shiboken::AutoDecRef pyChild(Shiboken::Conversions::pointerToPython(reinterpret_cast<SbkObjectType*>(Shiboken::SbkType<QObject>()), child));
PyObject_SetAttrString(root, name.constData(), pyChild);
#elif QT_VERSION >= 0x050000
const char* className = qt_identifyType(child, "PySide2.QtWidgets");
Expand Down Expand Up @@ -543,11 +540,7 @@ void PythonWrapper::setParent(PyObject* pyWdg, QObject* parent)
{
#if defined (HAVE_SHIBOKEN) && defined(HAVE_PYSIDE)
if (parent) {
#if defined (HAVE_SHIBOKEN2) && defined(HAVE_PYSIDE2)
Shiboken::AutoDecRef pyParent(Shiboken::Conversions::pointerToPython((SbkObjectType*)SbkPySide2_QtGuiTypes[SBK_QWIDGET_IDX], parent));
#else
Shiboken::AutoDecRef pyParent(Shiboken::Conversions::pointerToPython((SbkObjectType*)SbkPySide_QtGuiTypes[SBK_QWIDGET_IDX], parent));
#endif
Shiboken::AutoDecRef pyParent(Shiboken::Conversions::pointerToPython(reinterpret_cast<SbkObjectType*>(Shiboken::SbkType<QWidget>()), parent));
Shiboken::Object::setParent(pyParent, pyWdg);
}
#else
Expand Down

0 comments on commit 3eaf87b

Please sign in to comment.