QTransform _result; if (QTransform::quadToQuad(%1, %2, _result)) { %PYARG_0 = %CONVERTTOPYTHON[QTransform](_result); } else { Py_INCREF(Py_None); %PYARG_0 = Py_None; } QTransform _result; if (QTransform::quadToSquare(%1, _result)) { %PYARG_0 = %CONVERTTOPYTHON[QTransform](_result); } else { Py_INCREF(Py_None); %PYARG_0 = Py_None; } QTransform _result; if (QTransform::squareToQuad(%1, _result)) { %PYARG_0 = %CONVERTTOPYTHON[QTransform](_result); } else { Py_INCREF(Py_None); %PYARG_0 = Py_None; } uchar* buffer = (uchar*) Shiboken::Buffer::getPointer(%PYARG_2); QBitmap %0 = QBitmap::fromData(%1, buffer, %3); %PYARG_0 = %CONVERTTOPYTHON[QBitmap](%0); %BEGIN_ALLOW_THREADS %RETURN_TYPE %0 = %CPPSELF->::%TYPE::%FUNCTION_NAME(&%1, %2); %END_ALLOW_THREADS %PYARG_0 = Shiboken::makeTuple(%0, %1); if (_i < 0 || _i >= %CPPSELF.count()) { PyErr_SetString(PyExc_IndexError, "index out of bounds"); return 0; } int item = (*%CPPSELF)[_i]; return %CONVERTTOPYTHON[int](item); %PYARG_0 = Shiboken::Buffer::newObject(%CPPSELF.data(), %CPPSELF.size()); PyObject* %out = Shiboken::Buffer::newObject(%in, size); Py_ssize_t bufferLen; char* %out = (char*) Shiboken::Buffer::getPointer(%PYARG_1, &bufferLen); uint %out = bufferLen; const QTextDocument* doc = %CPPSELF.document(); if (doc) { Shiboken::AutoDecRef pyDocument(%CONVERTTOPYTHON[QTextDocument*](doc)); Shiboken::Object::setParent(pyDocument, %PYARG_1); } const QTextDocument* doc = %CPPSELF.document(); if (doc) { Shiboken::AutoDecRef pyDocument(%CONVERTTOPYTHON[QTextDocument*](doc)); Shiboken::Object::setParent(pyDocument, %PYARG_0); } PyObject* points = PyList_New(%CPPSELF.count()); for (int i = 0, max = %CPPSELF.count(); i < max; ++i){ int x, y; %CPPSELF.point(i, &x, &y); QPoint pt = QPoint(x, y); PyList_SET_ITEM(points, i, %CONVERTTOPYTHON[QPoint](pt)); } // %FUNCTION_NAME() *%CPPSELF << %1; %PYARG_0 = %CONVERTTOPYTHON[QPolygon*](%CPPSELF); // %FUNCTION_NAME() *%CPPSELF << %1; %PYARG_0 = %CONVERTTOPYTHON[QPolygon*](%CPPSELF); 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); %0 = new %TYPE(QPixmap::fromImage(%1)); const uchar* %out = reinterpret_cast<const uchar*>(PyString_AS_STRING(%PYARG_1)); uint %out = static_cast<uint>(PyString_GET_SIZE(%PYARG_1)); %PYARG_0 = Shiboken::Buffer::newObject(%CPPSELF.%FUNCTION_NAME(), %CPPSELF.byteCount()); // byteCount() is only available on Qt4.7, so we use bytesPerLine * height %PYARG_0 = Shiboken::Buffer::newObject(%CPPSELF.%FUNCTION_NAME(), %CPPSELF.bytesPerLine() * %CPPSELF.height(), Shiboken::Buffer::ReadWrite); %PYARG_0 = Shiboken::Buffer::newObject(%CPPSELF.%FUNCTION_NAME(%1), %CPPSELF.bytesPerLine()); %PYARG_0 = Shiboken::Buffer::newObject(%CPPSELF.%FUNCTION_NAME(%1), %CPPSELF.bytesPerLine(), Shiboken::Buffer::ReadWrite); PyObject *createFunction = 0; switch(%CPPSELF.spec()) { case QColor::Rgb: { qreal r, g, b, a; createFunction = PyObject_GetAttrString(%PYSELF, "fromRgbF"); %CPPSELF.getRgbF(&r, &g, &b, &a); %PYARG_0 = Py_BuildValue("(N(ffff))", createFunction, r, g, b, a); break; } case QColor::Hsv: { qreal h, s, v, a; createFunction = PyObject_GetAttrString(%PYSELF, "fromHsvF"); %CPPSELF.getHsvF(&h, &s, &v, &a); %PYARG_0 = Py_BuildValue("(N(ffff))", createFunction, h, s, v, a); break; } case QColor::Cmyk: { qreal c, m, y, k, a; createFunction = PyObject_GetAttrString(%PYSELF, "fromCmykF"); %CPPSELF.getCmykF(&c, &m, &y, &k, &a); %PYARG_0 = Py_BuildValue("(N(fffff))", createFunction, c, m, y, k, a); break; } #if QT_VERSION >= 0x040600 case QColor::Hsl: { qreal h, s, l, a; createFunction = PyObject_GetAttrString(%PYSELF, "fromHslF"); %CPPSELF.getHslF(&h, &s, &l, &a); %PYARG_0 = Py_BuildValue("(N(ffff))", createFunction, h, s, l, a); break; } #endif default: %PYARG_0 = 0; } switch(%CPPSELF.spec()) { case QColor::Rgb: { int r, g, b, a; %CPPSELF.getRgb(&r, &g, &b, &a); %PYARG_0 = Py_BuildValue("iiii", r, g, b, a); break; } case QColor::Hsv: { int h, s, v, a; %CPPSELF.getHsv(&h, &s, &v, &a); %PYARG_0 = Py_BuildValue("iiii", h, s, v, a); break; } case QColor::Cmyk: { int c, m, y, k, a; %CPPSELF.getCmyk(&c, &m, &y, &k, &a); %PYARG_0 = Py_BuildValue("iiiii", c, m, y, k, a); break; } case QColor::Hsl: { int h, s, l, a; %CPPSELF.getHsl(&h, &s, &l, &a); %PYARG_0 = Py_BuildValue("iiii", h, s, l, a); break; } default: %PYARG_0 = 0; } if (%1.type() == QVariant::Color) %0 = new %TYPE(%1.value<QColor>()); else PyErr_SetString(PyExc_TypeError, "QVariant must be holding a QColor"); int* array = NULL; bool errorOccurred = false; if (numArgs == 5) { array = Shiboken::sequenceToIntArray(%PYARG_5, true); if (PyErr_Occurred()) { if (array) delete []array; errorOccurred = true; } } if (!errorOccurred) { %RETURN_TYPE retval = %CPPSELF.%FUNCTION_NAME(%1, %2, %3, %4, array); if (array) delete []array; %PYARG_0 = %CONVERTTOPYTHON[%RETURN_TYPE](retval); } int* array = NULL; bool errorOccurred = false; if (numArgs == 4) { array = Shiboken::sequenceToIntArray(%PYARG_4, true); if (PyErr_Occurred()) { if (array) delete []array; errorOccurred = true; } } if (!errorOccurred) { %RETURN_TYPE retval = %CPPSELF.%FUNCTION_NAME(%1, %2, %3, array); if (array) delete []array; %PYARG_0 = %CONVERTTOPYTHON[%RETURN_TYPE](retval); } int* array = NULL; bool errorOccurred = false; if (numArgs == 8) { array = Shiboken::sequenceToIntArray(%PYARG_8, true); if (PyErr_Occurred()) { if (array) delete []array; errorOccurred = true; } } if (!errorOccurred) { %RETURN_TYPE retval = %CPPSELF.%FUNCTION_NAME(%1, %2, %3, %4, %5, %6, %7, array); if (array) delete []array; %PYARG_0 = %CONVERTTOPYTHON[%RETURN_TYPE](retval); } int* array = NULL; bool errorOccurred = false; if (numArgs == 5) { array = Shiboken::sequenceToIntArray(%PYARG_5, true); if (PyErr_Occurred()) { if (array) delete []array; errorOccurred = true; } } if (!errorOccurred) { %RETURN_TYPE retval = %CPPSELF.%FUNCTION_NAME(%1, %2, %3, %4, array); if (array) delete []array; %PYARG_0 = %CONVERTTOPYTHON[%RETURN_TYPE](retval); } int* array = NULL; bool errorOccurred = false; if (numArgs == 4) { array = Shiboken::sequenceToIntArray(%PYARG_4, true); if (PyErr_Occurred()) { if (array) delete []array; errorOccurred = true; } } if (!errorOccurred) { %RETURN_TYPE retval = %CPPSELF.%FUNCTION_NAME(%1, %2, %3, array); if (array) delete []array; %PYARG_0 = %CONVERTTOPYTHON[%RETURN_TYPE](retval); } PyObject* userTypeConstant = PyInt_FromLong(QGraphicsItem::UserType); PyDict_SetItemString(Sbk_QGraphicsItem_Type.super.ht_type.tp_dict, "UserType", userTypeConstant); QGraphicsItem *item_ = NULL; %RETURN_TYPE retval_ = %CPPSELF.%FUNCTION_NAME(&item_); %PYARG_0 = Shiboken::makeTuple(retval_, 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); %PYARG_0 = addActionWithPyObject(%CPPSELF, %1, %2); QPixmap p; if (%CPPSELF.%FUNCTION_NAME(%1, &p)) { %PYARG_0 = %CONVERTTOPYTHON[QPixmap](p); } else { %PYARG_0 = Py_None; Py_INCREF(%PYARG_0); } %0 = new %TYPE(%1, %2); Shiboken::AutoDecRef result(PyObject_CallMethod(%PYSELF, "connect", "OsO", %PYSELF, SIGNAL(activated()), %PYARG_3)); if (!result.isNull()) Shiboken::Object::setParent(%PYARG_2, %PYSELF); // Clear parent from the old child QStandardItem* _i = %CPPSELF->child(%1, %2); if (_i) { PyObject* _pyI = %CONVERTTOPYTHON[QStandardItem*](_i); Shiboken::Object::setParent(0, _pyI); } // Clear parent from the old child QStandardItem* _i = %CPPSELF->child(%1); if (_i) { PyObject* _pyI = %CONVERTTOPYTHON[QStandardItem*](_i); Shiboken::Object::setParent(0, _pyI); } QWidget *_widget = %CPPSELF.widget(%1); if (_widget) { Shiboken::AutoDecRef pyWidget(%CONVERTTOPYTHON[QWidget*](_widget)); Shiboken::Object::setParent(0, pyWidget); } bool ret = !(&%CPPSELF == %1); %PYARG_0 = %CONVERTTOPYTHON[bool](ret); addLayoutOwnership(%CPPSELF, %0); addLayoutOwnership(%CPPSELF, %1); addLayoutOwnership(%CPPSELF, %1); addLayoutOwnership(%CPPSELF, %1); addLayoutOwnership(%CPPSELF, %1); addLayoutOwnership(%CPPSELF, %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, %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 = Shiboken::makeTuple(a, b, c, 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++) { PyList_Append(option_object, %CONVERTTOPYTHON[QStyleOptionGraphicsItem](%in[i])); } 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->children()) 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 (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::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. Returns the window system identifier of the widget. Portable in principle, but if you use it you are probably about to do something non-portable. Be careful. If a widget is non-native (alien) and winId() is invoked on it, that widget will be provided a native handle. On X11 the type returned is long, on other platforms it's a PyCObject. This value may change at run-time. An event with type PySide.QtCore.QEvent.WinIdChange will be sent to the widget following a change in window system identifier. QWidget* tab = %CPPSELF.widget(%1); if (tab) { Shiboken::AutoDecRef pyWidget(%CONVERTTOPYTHON[QWidget*](tab)); %CPPSELF.%FUNCTION_NAME(%1); } for (int i = 0; i < %CPPSELF.count(); i++) { QWidget* widget = %CPPSELF.widget(i); Shiboken::AutoDecRef pyWidget(%CONVERTTOPYTHON[QWidget*](widget)); Shiboken::Object::setParent(0, pyWidget); } %CPPSELF.%FUNCTION_NAME(); // Clear parent from the old child QStandardItem* _i = %CPPSELF->item(%1, %2); if (_i) { PyObject* _pyI = %CONVERTTOPYTHON[QStandardItem*](_i); Shiboken::Object::setParent(0, _pyI); } // Clear parent from the old child QStandardItem* _i = %CPPSELF->item(%1); if (_i) { PyObject* _pyI = %CONVERTTOPYTHON[QStandardItem*](_i); Shiboken::Object::setParent(0, _pyI); } // Clear parent from the old child QStandardItem* _i = %CPPSELF->verticalHeaderItem(%1); if (_i) { PyObject* _pyI = %CONVERTTOPYTHON[QStandardItem*](_i); Shiboken::Object::setParent(0, _pyI); } for(int r=0, r_max = %CPPSELF.rowCount(); r < r_max; r++) { QList<QStandardItem *> ri = %CPPSELF.takeRow(0); PyObject *pyResult = %CONVERTTOPYTHON[QList<QStandardItem * >](ri); Shiboken::Object::setParent(Py_None, pyResult); Py_XDECREF(pyResult); } %RETURN_TYPE retval_ = %CPPSELF.%FUNCTION_NAME(%1, %2); %PYARG_0 = Shiboken::makeTuple(retval_, %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, "connect", "OsO", %PYARG_0, SIGNAL(triggered()), %PYARG_3)); QAction* action = %CPPSELF.addAction(%1); %PYARG_0 = %CONVERTTOPYTHON[QAction*](action); Shiboken::AutoDecRef result(PyObject_CallMethod(%PYARG_0, "connect", "OsO", %PYARG_0, SIGNAL(triggered()), %PYARG_2)); 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; } } %CPPSELF.clear(); foreach(PyObject* obj, lst) { Shiboken::Object::invalidate(reinterpret_cast<SbkObject* >(obj)); Py_XDECREF(obj); } %BEGIN_ALLOW_THREADS %CPPSELF.%FUNCTION_NAME(%1.data(), %1.size(), %2); %END_ALLOW_THREADS %BEGIN_ALLOW_THREADS %CPPSELF.%FUNCTION_NAME(%1.data(), %1.size(), %2); %END_ALLOW_THREADS PyObject* moduleQtGui; QApplicationConstructor(%PYSELF, %1, &%0); QApplicationConstructor(%PYSELF, %1, %2, &%0); QApplicationConstructor(%PYSELF, %1, %2, &%0); Shiboken::Object::setParent(%CONVERTTOPYTHON[QApplication*](qApp), %PYARG_1); QWidget* _old = %CPPSELF.widget(); if (_old) Shiboken::Object::setParent(NULL, %CONVERTTOPYTHON[QWidget*](_old)); %CPPSELF.%FUNCTION_NAME(%1); Shiboken::Object::setParent(%PYSELF, %PYARG_1); if (PySequence_Size(%PYARG_1) == 16) { qreal values[16]; for(int i=0; i < 16; i++) { PyObject *pv = PySequence_Fast_GET_ITEM(%PYARG_1, i); values[i] = PyFloat_AsDouble(pv); } %0 = new %TYPE(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15]); } qreal values[16]; %CPPSELF.%FUNCTION_NAME(values); %PYARG_0 = PyTuple_New(16); for(int i=0; i < 16; i++) { PyObject *v = PyFloat_FromDouble(values[i]); PyTuple_SET_ITEM(%PYARG_0, i, v); } if (PySequence_Check(_key)) { Shiboken::AutoDecRef key(PySequence_Fast(_key, "Invalid matrix index.")); if (PySequence_Fast_GET_SIZE(key.object()) == 2) { PyObject* posx = PySequence_Fast_GET_ITEM(key.object(), 0); PyObject* posy = PySequence_Fast_GET_ITEM(key.object(), 1); Py_ssize_t x = PyInt_AsSsize_t(posx); Py_ssize_t y = PyInt_AsSsize_t(posy); qreal ret = (*%CPPSELF)(x,y); return %CONVERTTOPYTHON[qreal](ret); } } PyErr_SetString(PyExc_IndexError, "Invalid matrix index."); return 0;