if (**%CPPSELF) { QTreeWidgetItemIterator *%0 = new QTreeWidgetItemIterator((*%CPPSELF)++); %PYARG_0 = %CONVERTTOPYTHON[QTreeWidgetItemIterator*](%0); } QTreeWidgetItem *%0 = %CPPSELF.operator*(); %PYARG_0 = %CONVERTTOPYTHON[QTreeWidgetItem*](%0); Shiboken::Object::releaseOwnership(%PYARG_0); PyObject *userTypeConstant = PyInt_FromLong(QGraphicsItem::UserType); PyDict_SetItemString(reinterpret_cast<PyTypeObject *>(Sbk_QGraphicsItem_TypeF())->tp_dict, "UserType", userTypeConstant); QGraphicsItem *item_ = NULL; %RETURN_TYPE retval_ = %CPPSELF.%FUNCTION_NAME(&item_); %PYARG_0 = PyTuple_New(2); PyTuple_SET_ITEM(%PYARG_0, 0, %CONVERTTOPYTHON[%RETURN_TYPE](retval_)); PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[QGraphicsItem*](item_)); Shiboken::Object::releaseOwnership(%PYARG_2); //this function is static we need keep ref to default value, to be able to call python virtual functions static PyObject* _defaultValue = 0; %CPPSELF.%FUNCTION_NAME(%1); Py_INCREF(%PYARG_1); if (_defaultValue) Py_DECREF(_defaultValue); _defaultValue = %PYARG_1; %PYARG_0 = addActionWithPyObject(%CPPSELF, QIcon(), %1, %2, %3); %PYARG_0 = addActionWithPyObject(%CPPSELF, %1, %2, %3, %4); %CPPSELF.addAction(%1); Shiboken::BindingManager& bm = Shiboken::BindingManager::instance(); PyObject* pyObj; foreach(QAction* act, %CPPSELF.actions()) { if ((pyObj = (PyObject*)bm.retrieveWrapper(act)) != 0) { Py_INCREF(pyObj); Shiboken::Object::setParent(NULL, pyObj); Shiboken::Object::invalidate(pyObj); Py_DECREF(pyObj); } } %PYARG_0 = addActionWithPyObject(%CPPSELF, %1, %2); foreach(QAction *act, %CPPSELF.actions()) { Shiboken::AutoDecRef pyAct(%CONVERTTOPYTHON[QAction*](act)); Shiboken::Object::setParent(NULL, pyAct); Shiboken::Object::invalidate(pyAct); } %CPPSELF.addAction(%1); %0 = new %TYPE(%1, %2); Shiboken::AutoDecRef result(PyObject_CallMethod(%PYSELF, const_cast<char *>("connect"), const_cast<char *>("OsO"), %PYSELF, SIGNAL(activated()), %PYARG_3) ); if (!result.isNull()) Shiboken::Object::setParent(%PYARG_2, %PYSELF); QWidget *_widget = %CPPSELF.widget(%1); if (_widget) { Shiboken::AutoDecRef pyWidget(%CONVERTTOPYTHON[QWidget*](_widget)); Shiboken::Object::setParent(0, pyWidget); } addLayoutOwnership(%CPPSELF, %0); removeLayoutOwnership(%CPPSELF, %1); removeLayoutOwnership(%CPPSELF, %1); addLayoutOwnership(%CPPSELF, %1); addLayoutOwnership(%CPPSELF, %1); addLayoutOwnership(%CPPSELF, %1); addLayoutOwnership(%CPPSELF, %1); addLayoutOwnership(%CPPSELF, %1); %CPPSELF.setAlignment(%1); addLayoutOwnership(%CPPSELF, %2); addLayoutOwnership(%CPPSELF, %1); addLayoutOwnership(%CPPSELF, %1); addLayoutOwnership(%CPPSELF, %2); addLayoutOwnership(%CPPSELF, %2); addLayoutOwnership(%CPPSELF, %2); addLayoutOwnership(%CPPSELF, %1); addLayoutOwnership(%CPPSELF, %2); addLayoutOwnership(%CPPSELF, %0); addLayoutOwnership(%CPPSELF, %1); addLayoutOwnership(%CPPSELF, %1); addLayoutOwnership(%CPPSELF, %1); addLayoutOwnership(%CPPSELF, %1); addLayoutOwnership(%CPPSELF, %1); int a, b, c, d; %CPPSELF.%FUNCTION_NAME(%1, &a, &b, &c, &d); %PYARG_0 = PyTuple_New(4); PyTuple_SET_ITEM(%PYARG_0, 0, %CONVERTTOPYTHON[int](a)); PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[int](b)); PyTuple_SET_ITEM(%PYARG_0, 2, %CONVERTTOPYTHON[int](c)); PyTuple_SET_ITEM(%PYARG_0, 3, %CONVERTTOPYTHON[int](d)); int %out = PySequence_Size(%PYARG_1); int numItems = PySequence_Size(%PYARG_1); Shiboken::AutoArrayPointer<QGraphicsItem*> %out(numItems); for (int i=0; i < numItems; i++) { %out[i] = %CONVERTTOCPP[QGraphicsItem*](PySequence_Fast_GET_ITEM(%PYARG_1, i)); } Shiboken::AutoDecRef object(PyList_New(0)); for (int i=0, max=numItems; i < max; i++) { PyList_Append(object, %CONVERTTOPYTHON[QGraphicsItem*](%in[i])); } PyObject *%out = object.object(); Shiboken::AutoDecRef option_object(PyList_New(0)); for (int i=0, max=numItems; i < max; i++) { const QStyleOptionGraphicsItem* item = &%in[i]; PyList_Append(option_object, %CONVERTTOPYTHON[QStyleOptionGraphicsItem](item)); } PyObject* %out = option_object.object(); int numOptions = PySequence_Size(%PYARG_2); Shiboken::AutoArrayPointer<QStyleOptionGraphicsItem> %out(numOptions); for (int i=0; i < numOptions; i++) { %out[i] = %CONVERTTOCPP[QStyleOptionGraphicsItem](PySequence_Fast_GET_ITEM(%PYARG_1, i)); } QGraphicsItem* parentItem = %1->parentItem(); Shiboken::AutoDecRef parent(%CONVERTTOPYTHON[QGraphicsItem*](parentItem)); foreach (QGraphicsItem* item, %1->childItems()) Shiboken::Object::setParent(parent, %CONVERTTOPYTHON[QGraphicsItem*](item)); %BEGIN_ALLOW_THREADS %CPPSELF.%FUNCTION_NAME(%1); %END_ALLOW_THREADS // the arg was destroyed by Qt. Shiboken::Object::invalidate(%PYARG_1); %RETURN_TYPE %0 = %CPPSELF.%FUNCTION_NAME(%1, %2); %PYARG_0 = %CONVERTTOPYTHON[%RETURN_TYPE](%0); Shiboken::Object::keepReference((SbkObject*)%PYARG_0, "setWidget(QWidget*)1", %PYARG_1); const QList<QGraphicsItem*> items = %CPPSELF.items(); Shiboken::BindingManager& bm = Shiboken::BindingManager::instance(); foreach (QGraphicsItem* item, items) { SbkObject* obj = bm.retrieveWrapper(item); if (obj) { if (reinterpret_cast<PyObject*>(obj)->ob_refcnt > 1) // If the refcnt is 1 the object will vannish anyway. Shiboken::Object::invalidate(obj); Shiboken::Object::removeParent(obj); } } %CPPSELF.%FUNCTION_NAME(); QTreeWidgetItem *rootItem = %CPPSELF.invisibleRootItem(); Shiboken::BindingManager &bm = Shiboken::BindingManager::instance(); for (int i = 0; i < rootItem->childCount(); ++i) { QTreeWidgetItem *item = rootItem->child(i); SbkObject* wrapper = bm.retrieveWrapper(item); if (wrapper) Shiboken::Object::setParent(0, reinterpret_cast<PyObject*>(wrapper)); } // Only call the parent function if this return some value // the parent can be the TreeWidget if (%0) Shiboken::Object::setParent(%PYARG_0, %PYSELF); // Only call the parent function if this return some value // the parent can be the TreeWidgetItem if (%0) Shiboken::Object::setParent(%PYARG_0, %PYSELF); Shiboken::BindingManager &bm = Shiboken::BindingManager::instance(); PyObject *pyObj; for (int i = 0; i < %CPPSELF.count(); i++) { QListWidgetItem *item = %CPPSELF.item(i); if ((pyObj = reinterpret_cast<PyObject*>(bm.retrieveWrapper(item))) != 0) { Py_INCREF(pyObj); Shiboken::Object::setParent(NULL, pyObj); Shiboken::Object::invalidate(pyObj); Py_DECREF(pyObj); } } %CPPSELF.%FUNCTION_NAME(); Shiboken::Object::keepReference(reinterpret_cast<SbkObject*>(%PYSELF), "__style__", %PYARG_1); QStyle* myStyle = %CPPSELF->style(); if (myStyle && qApp) { %PYARG_0 = %CONVERTTOPYTHON[QStyle*](myStyle); QStyle *appStyle = qApp->style(); if (appStyle == myStyle) { Shiboken::AutoDecRef pyApp(%CONVERTTOPYTHON[QApplication*](qApp)); Shiboken::Object::setParent(pyApp, %PYARG_0); Shiboken::Object::releaseOwnership(%PYARG_0); } else { Shiboken::Object::keepReference(reinterpret_cast<SbkObject*>(%PYSELF), "__style__", %PYARG_0); } } qwidgetSetLayout(%CPPSELF, %1); // %FUNCTION_NAME() - disable generation of function call. QWidget* tab = %CPPSELF.widget(%1); if (tab) { Shiboken::AutoDecRef pyWidget(%CONVERTTOPYTHON[QWidget*](tab)); %CPPSELF.%FUNCTION_NAME(%1); } Shiboken::BindingManager& bm = Shiboken::BindingManager::instance(); for (int i = 0; i < %CPPSELF.count(); i++) { QWidget* widget = %CPPSELF.widget(i); if (bm.hasWrapper(widget)) { Shiboken::AutoDecRef pyWidget(%CONVERTTOPYTHON[QWidget*](widget)); Shiboken::Object::releaseOwnership(pyWidget); } } %CPPSELF.%FUNCTION_NAME(); %CPPSELF.addAction(%1); :: def callback_int(value_as_int): print 'int value changed:', repr(value_as_int) app = QApplication(sys.argv) spinbox = QSpinBox() spinbox.valueChanged[unicode].connect(callback_unicode) spinbox.show() sys.exit(app.exec_()) :: def callback_unicode(value_as_unicode): print 'unicode value changed:', repr(value_as_unicode) app = QApplication(sys.argv) spinbox = QSpinBox() spinbox.valueChanged[unicode].connect(callback_unicode) spinbox.show() sys.exit(app.exec_()) QAction *action = %CPPSELF.addAction(%1, %2); %PYARG_0 = %CONVERTTOPYTHON[QAction*](action); Shiboken::AutoDecRef result(PyObject_CallMethod(%PYARG_0, const_cast<char *>("connect"), const_cast<char *>("OsO"), %PYARG_0, SIGNAL(triggered()), %PYARG_3) ); QAction *action = %CPPSELF.addAction(%1); %PYARG_0 = %CONVERTTOPYTHON[QAction*](action); Shiboken::AutoDecRef result(PyObject_CallMethod(%PYARG_0, const_cast<char *>("connect"), const_cast<char *>("OsO"), %PYARG_0, SIGNAL(triggered()), %PYARG_2) ); %CPPSELF.addAction(%1); QList<PyObject* > lst; Shiboken::BindingManager& bm = Shiboken::BindingManager::instance(); foreach(QToolButton* child, %CPPSELF.findChildren<QToolButton*>()) { if (bm.hasWrapper(child)) { PyObject* pyChild = %CONVERTTOPYTHON[QToolButton*](child); Shiboken::Object::setParent(0, pyChild); lst << pyChild; } } //Remove actions foreach(QAction *act, %CPPSELF.actions()) { Shiboken::AutoDecRef pyAct(%CONVERTTOPYTHON[QAction*](act)); Shiboken::Object::setParent(NULL, pyAct); Shiboken::Object::invalidate(pyAct); } %CPPSELF.clear(); foreach(PyObject* obj, lst) { Shiboken::Object::invalidate(reinterpret_cast<SbkObject* >(obj)); Py_XDECREF(obj); } QApplicationConstructor(%PYSELF, args, &%0); PyObject *empty = PyTuple_New(2); if (!PyTuple_SetItem(empty, 0, PyList_New(0))) { QApplicationConstructor(%PYSELF, empty, &%0); } QWidget* _old = %CPPSELF.widget(); if (_old) Shiboken::Object::setParent(NULL, %CONVERTTOPYTHON[QWidget*](_old)); %CPPSELF.%FUNCTION_NAME(%1); Shiboken::Object::setParent(%PYSELF, %PYARG_1);