23
#include "PreCompiled.h"
26
# include <unordered_map>
29
# include <QApplication>
48
#pragma warning( disable : 4099 )
49
#pragma warning( disable : 4522 )
54
# pragma clang diagnostic push
55
# pragma clang diagnostic ignored "-Wmismatched-tags"
56
# pragma clang diagnostic ignored "-Wunused-parameter"
57
# if __clang_major__ > 3
58
# pragma clang diagnostic ignored "-Wkeyword-macro"
60
#elif defined (__GNUC__)
61
# pragma GCC diagnostic push
62
# pragma GCC diagnostic ignored "-Wunused-parameter"
63
# pragma GCC diagnostic ignored "-Wdeprecated-declarations"
86
# define SHIBOKEN_FULL_VERSION QT_VERSION_CHECK(SHIBOKEN_MAJOR_VERSION, SHIBOKEN_MINOR_VERSION, 0)
87
# if (SHIBOKEN_FULL_VERSION >= QT_VERSION_CHECK(5, 12, 0))
88
# define HAVE_SHIBOKEN_TYPE_FOR_TYPENAME
91
# ifndef HAVE_SHIBOKEN_TYPE_FOR_TYPENAME
92
# include <pyside2_qtcore_python.h>
93
# include <pyside2_qtgui_python.h>
94
# include <pyside2_qtwidgets_python.h>
107
# define HAVE_SHIBOKEN
110
# define HAVE_SHIBOKEN_TYPE_FOR_TYPENAME
112
# include <sbkversion.h>
113
# define SHIBOKEN_FULL_VERSION QT_VERSION_CHECK(SHIBOKEN_MAJOR_VERSION, SHIBOKEN_MINOR_VERSION, 0)
114
# if (SHIBOKEN_FULL_VERSION >= QT_VERSION_CHECK(6, 7, 0))
115
# define HAVE_SHIBOKEN_TYPEINITSTRUCT
122
# undef _POSIX_C_SOURCE
124
# include <basewrapper.h>
125
# include <sbkconverter.h>
126
# include <sbkmodule.h>
127
# include <shiboken.h>
131
# include <signalmanager.h>
136
#if defined(__clang__)
137
# pragma clang diagnostic pop
138
#elif defined (__GNUC__)
139
# pragma GCC diagnostic pop
144
# include <QGraphicsItem>
145
# include <QGraphicsObject>
148
#include <App/Application.h>
149
#include <Base/Interpreter.h>
150
#include <Base/Quantity.h>
151
#include <Base/QuantityPy.h>
153
#include "PythonWrapper.h"
155
#include "MetaTypes.h"
158
#if defined(HAVE_SHIBOKEN2)
159
PyTypeObject** SbkPySide2_QtCoreTypes = nullptr;
160
PyTypeObject** SbkPySide2_QtGuiTypes = nullptr;
161
PyTypeObject** SbkPySide2_QtWidgetsTypes = nullptr;
162
PyTypeObject** SbkPySide2_QtPrintSupportTypes = nullptr;
163
PyTypeObject** SbkPySide2_QtUiToolsTypes = nullptr;
164
constexpr auto &SbkPySide_QtCoreTypes = SbkPySide2_QtCoreTypes;
165
constexpr auto &SbkPySide_QtGuiTypes = SbkPySide2_QtGuiTypes;
166
constexpr auto &SbkPySide_QtWidgetsTypes = SbkPySide2_QtWidgetsTypes;
167
constexpr auto &SbkPySide_QtPrintSupportTypes = SbkPySide2_QtPrintSupportTypes;
168
constexpr auto &SbkPySide_QtUiToolsTypes = SbkPySide2_QtUiToolsTypes;
169
#if !defined(HAVE_PYSIDE2)
170
constexpr const char* ModuleShiboken = "shiboken2";
172
constexpr const char* ModulePySide = "PySide2";
173
#elif defined(HAVE_SHIBOKEN6)
174
#ifdef HAVE_SHIBOKEN_TYPEINITSTRUCT
175
Shiboken::Module::TypeInitStruct* SbkPySide6_QtCoreTypes = nullptr;
176
Shiboken::Module::TypeInitStruct* SbkPySide6_QtGuiTypes = nullptr;
177
Shiboken::Module::TypeInitStruct* SbkPySide6_QtWidgetsTypes = nullptr;
178
Shiboken::Module::TypeInitStruct* SbkPySide6_QtPrintSupportTypes = nullptr;
179
Shiboken::Module::TypeInitStruct* SbkPySide6_QtUiToolsTypes = nullptr;
181
PyTypeObject** SbkPySide6_QtCoreTypes = nullptr;
182
PyTypeObject** SbkPySide6_QtGuiTypes = nullptr;
183
PyTypeObject** SbkPySide6_QtWidgetsTypes = nullptr;
184
PyTypeObject** SbkPySide6_QtPrintSupportTypes = nullptr;
185
PyTypeObject** SbkPySide6_QtUiToolsTypes = nullptr;
187
constexpr auto &SbkPySide_QtCoreTypes = SbkPySide6_QtCoreTypes;
188
constexpr auto &SbkPySide_QtGuiTypes = SbkPySide6_QtGuiTypes;
189
constexpr auto &SbkPySide_QtWidgetsTypes = SbkPySide6_QtWidgetsTypes;
190
constexpr auto &SbkPySide_QtPrintSupportTypes = SbkPySide6_QtPrintSupportTypes;
191
constexpr auto &SbkPySide_QtUiToolsTypes = SbkPySide6_QtUiToolsTypes;
192
#if !defined(HAVE_PYSIDE6)
193
constexpr const char* ModuleShiboken = "shiboken6";
195
constexpr const char* ModulePySide = "PySide6";
197
static PyTypeObject** SbkPySide_DummyTypes;
198
constexpr auto &SbkPySide_QtCoreTypes = SbkPySide_DummyTypes;
199
constexpr auto &SbkPySide_QtGuiTypes = SbkPySide_DummyTypes;
200
constexpr auto &SbkPySide_QtWidgetsTypes = SbkPySide_DummyTypes;
201
constexpr auto &SbkPySide_QtPrintSupportTypes = SbkPySide_DummyTypes;
202
constexpr auto &SbkPySide_QtUiToolsTypes = SbkPySide_DummyTypes;
203
# if QT_VERSION < QT_VERSION_CHECK(6,0,0)
204
constexpr const char* ModuleShiboken = "shiboken2";
205
constexpr const char* ModulePySide = "PySide2";
207
constexpr const char* ModuleShiboken = "shiboken6";
208
constexpr const char* ModulePySide = "PySide6";
215
#if defined (HAVE_SHIBOKEN)
227
PyObject* toPythonFuncQuantityTyped(Base::Quantity cpx)
229
return new Base::QuantityPy(new Base::Quantity(cpx));
232
PyObject* toPythonFuncQuantity(const void* cpp)
234
return toPythonFuncQuantityTyped(*static_cast<const Base::Quantity*>(cpp));
237
void toCppPointerConvFuncQuantity(PyObject* pyobj,void* cpp)
239
*static_cast<Base::Quantity*>(cpp) = *static_cast<Base::QuantityPy*>(pyobj)->getQuantityPtr();
242
PythonToCppFunc toCppPointerCheckFuncQuantity(PyObject* obj)
244
if (PyObject_TypeCheck(obj, &(Base::QuantityPy::Type))) {
245
return toCppPointerConvFuncQuantity;
250
void BaseQuantity_PythonToCpp_QVariant(PyObject* pyIn, void* cppOut)
252
Base::Quantity* q = static_cast<Base::QuantityPy*>(pyIn)->getQuantityPtr();
253
*((QVariant*)cppOut) = QVariant::fromValue<Base::Quantity>(*q);
256
PythonToCppFunc isBaseQuantity_PythonToCpp_QVariantConvertible(PyObject* obj)
258
if (PyObject_TypeCheck(obj, &(Base::QuantityPy::Type))) {
259
return BaseQuantity_PythonToCpp_QVariant;
264
#if defined (HAVE_PYSIDE)
265
Base::Quantity convertWrapperToQuantity(const PySide::PyObjectWrapper &w)
267
auto pyIn = static_cast<PyObject*>(w);
268
if (PyObject_TypeCheck(pyIn, &(Base::QuantityPy::Type))) {
269
return *static_cast<Base::QuantityPy*>(pyIn)->getQuantityPtr();
272
return Base::Quantity(std::numeric_limits<double>::quiet_NaN());
278
SbkConverter* convert = Shiboken::Conversions::createConverter(&Base::QuantityPy::Type,
279
toPythonFuncQuantity);
280
Shiboken::Conversions::setPythonToCppPointerFunctions(convert,
281
toCppPointerConvFuncQuantity,
282
toCppPointerCheckFuncQuantity);
283
Shiboken::Conversions::registerConverterName(convert, "Base::Quantity");
285
SbkConverter* qvariant_conv = Shiboken::Conversions::getConverter("QVariant");
289
Shiboken::Conversions::addPythonToCppValueConversion(qvariant_conv,
290
BaseQuantity_PythonToCpp_QVariant,
291
isBaseQuantity_PythonToCpp_QVariantConvertible);
294
#if defined (HAVE_PYSIDE)
295
QMetaType::registerConverter<PySide::PyObjectWrapper, Base::Quantity>(&convertWrapperToQuantity);
304
static std::string getPySideModuleName(const std::string& moduleName)
306
std::string name(ModulePySide);
313
#ifdef HAVE_SHIBOKEN_TYPEINITSTRUCT
314
static bool loadPySideModule(const std::string& moduleName, Shiboken::Module::TypeInitStruct*& types)
316
static bool loadPySideModule(const std::string& moduleName, PyTypeObject**& types)
319
#if defined (HAVE_SHIBOKEN) && defined(HAVE_PYSIDE)
321
Shiboken::AutoDecRef requiredModule(Shiboken::Module::import(getPySideModuleName(moduleName).c_str()));
322
if (requiredModule.isNull()) {
325
types = Shiboken::Module::getTypes(requiredModule);
334
#if defined (HAVE_SHIBOKEN) && defined(HAVE_PYSIDE)
335
template<typename qttype>
336
#if defined (HAVE_SHIBOKEN2)
341
getPyTypeObjectForTypeName()
343
#if defined (HAVE_SHIBOKEN_TYPE_FOR_TYPENAME)
344
# if defined (HAVE_SHIBOKEN2)
345
auto sbkType = Shiboken::ObjectType::typeForTypeName(typeid(qttype).name());
346
return reinterpret_cast<SbkObjectType*>(&sbkType->type);
348
return Shiboken::ObjectType::typeForTypeName(typeid(qttype).name());
351
# if defined (HAVE_SHIBOKEN2)
352
return reinterpret_cast<SbkObjectType*>(Shiboken::SbkType<qttype>());
354
return Shiboken::SbkType<qttype>();
359
template<typename qttype>
360
qttype* qt_getCppType(PyObject* pyobj)
362
auto type = getPyTypeObjectForTypeName<qttype>();
364
if (Shiboken::Object::checkType(pyobj)) {
365
auto skbobj = reinterpret_cast<SbkObject *>(pyobj);
366
auto pytypeobj = reinterpret_cast<PyTypeObject *>(type);
367
return static_cast<qttype*>(Shiboken::Object::cppPointer(skbobj, pytypeobj));
387
class WrapperManager : public QObject
391
static WrapperManager& instance()
393
static WrapperManager singleton;
402
void addQObject(QObject* obj, PyObject* pyobj)
404
const auto PyW_unique_name = QString::number(reinterpret_cast <quintptr> (pyobj));
405
auto PyW_invalidator = findChild <QObject *> (PyW_unique_name, Qt::FindDirectChildrenOnly);
407
if (PyW_invalidator == nullptr) {
408
PyW_invalidator = new QObject(this);
409
PyW_invalidator->setObjectName(PyW_unique_name);
414
PyW_invalidator->disconnect();
417
auto destroyedFun = [pyobj](){
418
Base::PyGILStateLocker lock;
419
auto sbk_ptr = reinterpret_cast <SbkObject *> (pyobj);
420
if (sbk_ptr != nullptr) {
421
Shiboken::Object::setValidCpp(sbk_ptr, false);
424
Base::Console().DeveloperError("WrapperManager", "A QObject has just been destroyed after its Pythonic wrapper.\n");
429
QObject::connect(PyW_invalidator, &QObject::destroyed, this, destroyedFun);
430
QObject::connect(obj, &QObject::destroyed, PyW_invalidator, &QObject::deleteLater);
434
void wrapQApplication()
443
auto type = getPyTypeObjectForTypeName<QApplication>();
445
PyObject* pyobj = Shiboken::Object::newObject(type, qApp, false, false, "QApplication");
446
addQObject(qApp, pyobj);
454
~WrapperManager() override = default;
459
static std::string formatModuleError(const std::string& name)
461
std::string error = "Cannot load " + name + " module";
465
static PyObject* importShiboken()
467
PyObject* obj = PyImport_ImportModule(ModuleShiboken);
472
throw Py::Exception(PyExc_ImportError, formatModuleError(ModuleShiboken));
475
static PyObject* importPySide(const std::string& moduleName)
477
std::string name = getPySideModuleName(moduleName);
478
PyObject* obj = PyImport_ImportModule(name.c_str());
483
throw Py::Exception(PyExc_ImportError, formatModuleError(name));
486
template<typename qttype>
487
qttype* qt_getCppType(PyObject* pyobj)
490
Py::Module mainmod(importShiboken(), true);
491
Py::Callable func = mainmod.getDict().getItem("getCppPointer");
493
throw Py::RuntimeError("Failed to get C++ pointer");
496
Py::Tuple arguments(1);
497
arguments[0] = Py::Object(pyobj);
498
Py::Tuple result(func.apply(arguments));
499
return reinterpret_cast<qttype*>(PyLong_AsVoidPtr(result[0].ptr()));
502
template<typename qttype>
503
Py::Object qt_wrapInstance(qttype object,
504
const std::string& className,
505
const std::string& moduleName)
507
Py::Module mainmod(importShiboken(), true);
508
Py::Callable func = mainmod.getDict().getItem("wrapInstance");
514
Py::Module qtmod(importPySide(moduleName));
515
Py::Object item = qtmod.getDict().getItem(className);
521
Py::Tuple arguments(2);
522
arguments[0] = Py::asObject(PyLong_FromVoidPtr((void*)object));
525
return func.apply(arguments);
528
const char* qt_identifyType(QObject* ptr, const std::string& moduleName)
530
Py::Module qtmod(importPySide(moduleName));
531
const QMetaObject* metaObject = ptr->metaObject();
533
const char* className = metaObject->className();
534
if (qtmod.getDict().hasKey(className)) {
537
metaObject = metaObject->superClass();
549
PythonWrapper::PythonWrapper()
551
#if defined (HAVE_SHIBOKEN)
560
bool PythonWrapper::toCString(const Py::Object& pyobject, std::string& str)
562
if (PyUnicode_Check(pyobject.ptr())) {
563
PyObject* unicode = PyUnicode_AsUTF8String(pyobject.ptr());
564
str = PyBytes_AsString(unicode);
568
else if (PyBytes_Check(pyobject.ptr())) {
569
str = PyBytes_AsString(pyobject.ptr());
572
#if defined (HAVE_SHIBOKEN) && defined(HAVE_PYSIDE)
573
if (Shiboken::String::check(pyobject.ptr())) {
574
const char* s = Shiboken::String::toCString(pyobject.ptr());
582
QObject* PythonWrapper::toQObject(const Py::Object& pyobject)
584
return qt_getCppType<QObject>(pyobject.ptr());
587
qsizetype PythonWrapper::tryEnum(PyObject* pyPtr)
589
if (PyObject* number = PyNumber_Long(pyPtr)) {
590
Py::Long longObj(number, true);
591
return longObj.as_long();
597
Py::Object object(pyPtr);
598
if (object.hasAttr(std::string("value"))) {
599
Py::Long longObj(object.getAttr(std::string("value")));
600
return longObj.as_long();
606
qsizetype PythonWrapper::toEnum(PyObject* pyPtr)
609
return tryEnum(pyPtr);
611
catch (Py::Exception&) {
618
qsizetype PythonWrapper::toEnum(const Py::Object& pyobject)
620
return toEnum(pyobject.ptr());
623
Py::Object PythonWrapper::tryToStandardButton(qsizetype value)
625
std::stringstream cmd;
626
cmd << "from PySide import QtWidgets\n";
627
cmd << "btn = QtWidgets.QDialogButtonBox.StandardButton(" << value << ")";
628
return Py::asObject(Base::Interpreter().getValue(cmd.str().c_str(), "btn"));
631
Py::Object PythonWrapper::toStandardButton(qsizetype value)
634
return tryToStandardButton(value);
636
catch (Py::Exception& e) {
638
return Py::Long(value);
642
QGraphicsItem* PythonWrapper::toQGraphicsItem(PyObject* pyPtr)
644
return qt_getCppType<QGraphicsItem>(pyPtr);
647
QGraphicsItem* PythonWrapper::toQGraphicsItem(const Py::Object& pyobject)
649
return toQGraphicsItem(pyobject.ptr());
652
QGraphicsObject* PythonWrapper::toQGraphicsObject(PyObject* pyPtr)
654
return qt_getCppType<QGraphicsObject>(pyPtr);
657
QGraphicsObject* PythonWrapper::toQGraphicsObject(const Py::Object& pyobject)
659
return toQGraphicsObject(pyobject.ptr());
662
Py::Object PythonWrapper::fromQImage(const QImage& img)
664
#if defined (HAVE_SHIBOKEN) && defined(HAVE_PYSIDE)
665
auto type = getPyTypeObjectForTypeName<QImage>();
667
PyObject* pyobj = Shiboken::Conversions::copyToPython(type, const_cast<QImage*>(&img));
668
return Py::asObject(pyobj);
672
Py::Object obj = qt_wrapInstance<const QImage*>(&img, "QImage", "QtGui");
677
throw Py::RuntimeError("Failed to wrap image");
680
QImage *PythonWrapper::toQImage(PyObject *pyobj)
682
return qt_getCppType<QImage>(pyobj);
685
Py::Object PythonWrapper::fromQIcon(const QIcon* icon)
687
#if defined (HAVE_SHIBOKEN) && defined(HAVE_PYSIDE)
688
auto type = getPyTypeObjectForTypeName<QIcon>();
690
const char* typeName = typeid(*const_cast<QIcon*>(icon)).name();
691
PyObject* pyobj = Shiboken::Object::newObject(type, const_cast<QIcon*>(icon), true, false, typeName);
692
return Py::asObject(pyobj);
696
Py::Object obj = qt_wrapInstance<const QIcon*>(icon, "QIcon", "QtGui");
701
throw Py::RuntimeError("Failed to wrap icon");
704
QIcon *PythonWrapper::toQIcon(PyObject *pyobj)
706
return qt_getCppType<QIcon>(pyobj);
709
Py::Object PythonWrapper::fromQDir(const QDir& dir)
711
#if defined (HAVE_SHIBOKEN) && defined(HAVE_PYSIDE)
712
auto type = getPyTypeObjectForTypeName<QDir>();
714
const char* typeName = typeid(dir).name();
715
PyObject* pyobj = Shiboken::Object::newObject(type, const_cast<QDir*>(&dir), false, false, typeName);
716
return Py::asObject(pyobj);
720
Py::Object obj = qt_wrapInstance<const QDir*>(&dir, "QDir", "QtGui");
725
throw Py::RuntimeError("Failed to wrap directory");
728
QDir* PythonWrapper::toQDir(PyObject* pyobj)
730
return qt_getCppType<QDir>(pyobj);
733
Py::Object PythonWrapper::fromQAction(QAction* action)
735
#if defined (HAVE_SHIBOKEN) && defined(HAVE_PYSIDE)
737
auto type = getPyTypeObjectForTypeName<QAction>();
739
PyObject* pyobj = Shiboken::Object::newObject(type, action, false, false, "QAction");
740
WrapperManager::instance().addQObject(action, pyobj);
741
return Py::asObject(pyobj);
745
# if QT_VERSION < QT_VERSION_CHECK(6,0,0)
746
constexpr const char* qtModWithQAction = "QtWidgets";
748
constexpr const char* qtModWithQAction = "QtGui";
750
Py::Object obj = qt_wrapInstance<QAction*>(action, "QAction", qtModWithQAction);
755
throw Py::RuntimeError("Failed to wrap action");
758
Py::Object PythonWrapper::fromQPrinter(QPrinter* printer)
763
#if defined (HAVE_SHIBOKEN) && defined(HAVE_PYSIDE)
765
auto type = getPyTypeObjectForTypeName<QPrinter>();
768
#if defined (HAVE_SHIBOKEN2)
769
type = reinterpret_cast<SbkObjectType*>(Shiboken::Conversions::getPythonTypeObject("QPrinter"));
771
type = Shiboken::Conversions::getPythonTypeObject("QPrinter");
775
PyObject* pyobj = Shiboken::Object::newObject(type, printer, false, false, "QPrinter");
776
return Py::asObject(pyobj);
780
Py::Object obj = qt_wrapInstance<QPrinter*>(printer, "QPrinter", "QtCore");
785
throw Py::RuntimeError("Failed to wrap printer");
788
Py::Object PythonWrapper::fromQObject(QObject* object, const char* className)
793
const char* typeName;
795
typeName = className;
798
typeName = object->metaObject()->className();
800
#if defined (HAVE_SHIBOKEN) && defined(HAVE_PYSIDE)
802
auto type = getPyTypeObjectForTypeName<QObject>();
804
PyObject* pyobj = Shiboken::Object::newObject(type, object, false, false, typeName);
805
WrapperManager::instance().addQObject(object, pyobj);
806
return Py::asObject(pyobj);
810
Py::Object obj = qt_wrapInstance<QObject*>(object, typeName, "QtCore");
815
throw Py::RuntimeError("Failed to wrap object");
818
Py::Object PythonWrapper::fromQWidget(QWidget* widget, const char* className)
820
const char* typeName;
822
typeName = className;
825
typeName = widget->metaObject()->className();
827
#if defined (HAVE_SHIBOKEN) && defined(HAVE_PYSIDE)
829
auto type = getPyTypeObjectForTypeName<QWidget>();
831
PyObject* pyobj = Shiboken::Object::newObject(type, widget, false, false, typeName);
832
WrapperManager::instance().addQObject(widget, pyobj);
833
return Py::asObject(pyobj);
837
Py::Object obj = qt_wrapInstance<QWidget*>(widget, typeName, "QtWidgets");
842
throw Py::RuntimeError("Failed to wrap widget");
845
const char* PythonWrapper::getWrapperName(QObject* obj) const
847
#if defined (HAVE_SHIBOKEN) && defined(HAVE_PYSIDE)
848
const QMetaObject* meta = obj->metaObject();
850
const char* typeName = meta->className();
851
PyTypeObject* exactType = Shiboken::Conversions::getPythonTypeObject(typeName);
855
meta = meta->superClass();
859
QStringList names = ui.availableWidgets();
860
const QMetaObject* meta = obj->metaObject();
862
const char* typeName = meta->className();
863
if (names.indexOf(QLatin1String(typeName)) >= 0) {
866
meta = meta->superClass();
872
bool PythonWrapper::loadCoreModule()
874
return loadPySideModule("QtCore", SbkPySide_QtCoreTypes);
877
bool PythonWrapper::loadGuiModule()
879
return loadPySideModule("QtGui", SbkPySide_QtGuiTypes);
882
bool PythonWrapper::loadWidgetsModule()
884
return loadPySideModule("QtWidgets", SbkPySide_QtWidgetsTypes);
887
bool PythonWrapper::loadPrintSupportModule()
889
return loadPySideModule("QtPrintSupport", SbkPySide_QtPrintSupportTypes);
892
bool PythonWrapper::loadUiToolsModule()
894
return loadPySideModule("QtUiTools", SbkPySide_QtUiToolsTypes);
897
void PythonWrapper::createChildrenNameAttributes(PyObject* root, QObject* object)
899
Q_FOREACH (QObject* child, object->children()) {
900
const QByteArray name = child->objectName().toLocal8Bit();
902
if (!name.isEmpty() && !name.startsWith("_") && !name.startsWith("qt_")) {
903
bool hasAttr = PyObject_HasAttrString(root, name.constData());
905
#if defined (HAVE_SHIBOKEN) && defined(HAVE_PYSIDE)
906
Shiboken::AutoDecRef pyChild(Shiboken::Conversions::pointerToPython(getPyTypeObjectForTypeName<QObject>(), child));
907
PyObject_SetAttrString(root, name.constData(), pyChild);
909
const char* className = qt_identifyType(child, "QtWidgets");
911
if (qobject_cast<QWidget*>(child)) {
912
className = "QWidget";
915
className = "QObject";
919
Py::Object pyChild(qt_wrapInstance<QObject*>(child, className, "QtWidgets"));
920
if (!pyChild.isNull()) {
921
PyObject_SetAttrString(root, name.constData(), pyChild.ptr());
925
createChildrenNameAttributes(root, child);
927
createChildrenNameAttributes(root, child);
931
void PythonWrapper::setParent(PyObject* pyWdg, QObject* parent)
933
#if defined (HAVE_SHIBOKEN) && defined(HAVE_PYSIDE)
935
Shiboken::AutoDecRef pyParent(Shiboken::Conversions::pointerToPython(getPyTypeObjectForTypeName<QWidget>(), parent));
936
Shiboken::Object::setParent(pyParent, pyWdg);