PyObject* convert_QObjectList_to_PyListObject(QObjectList* origlist) { PyObject* resultList = PyList_New(0); if (!resultList) return NULL; PyObject* objPtr = NULL; // Loop over the objects in the list and add them to the python // list wrapped in PyCObjects . for (int i = 0; i < origlist->count(); ++i) { // Wrap up the object pointer objPtr = wrapQObject(origlist->at(i)); if (!objPtr) { // Failed to wrap the object. An exception is already set. Py_DECREF(resultList); return NULL; } // and add it to the list if (PyList_Append(resultList, (PyObject*)objPtr) == -1) return NULL; } return resultList; }
SEXP qt_qgraphicsScene() { return wrapQObject(new QGraphicsScene(0)); }