diff options
Diffstat (limited to 'PySide/QtCore/glue/qcoreapplication_init.cpp')
-rw-r--r-- | PySide/QtCore/glue/qcoreapplication_init.cpp | 34 |
1 files changed, 7 insertions, 27 deletions
diff --git a/PySide/QtCore/glue/qcoreapplication_init.cpp b/PySide/QtCore/glue/qcoreapplication_init.cpp index 15e3e1118..c92f03e0b 100644 --- a/PySide/QtCore/glue/qcoreapplication_init.cpp +++ b/PySide/QtCore/glue/qcoreapplication_init.cpp @@ -2,43 +2,23 @@ static int QCoreApplicationArgCount; static char** QCoreApplicationArgValues; -int Sbk_QCoreApplication_Init(PyObject* self, PyObject* args, PyObject*) +void QCoreApplication_constructor(PyObject* self, PyObject* args, QCoreApplicationWrapper** cptr) { - if (Shiboken::Object::isUserType(self) && !Shiboken::ObjectType::canCallConstructor(self->ob_type, Shiboken::SbkType<QCoreApplication >())) - return -1; - - if (QCoreApplication::instance()) { PyErr_SetString(PyExc_RuntimeError, "A QCoreApplication instance already exists."); - return -1; + return; } int numArgs = PyTuple_GET_SIZE(args); - if (numArgs != 1) { + if (numArgs != 1 + || !Shiboken::sequenceToArgcArgv(PyTuple_GET_ITEM(args, 0), &QCoreApplicationArgCount, &QCoreApplicationArgValues, "PySideApp")) { PyErr_BadArgument(); - return -1; + return; } - if (!Shiboken::sequenceToArgcArgv(PyTuple_GET_ITEM(args, 0), &QCoreApplicationArgCount, &QCoreApplicationArgValues, "PySideApp")) { - PyErr_BadArgument(); - return -1; - } - - SbkObject* sbkSelf = reinterpret_cast<SbkObject*>(self); - QCoreApplicationWrapper* cptr = new QCoreApplicationWrapper(QCoreApplicationArgCount, QCoreApplicationArgValues); - Shiboken::Object::setCppPointer(sbkSelf, - Shiboken::SbkType<QCoreApplication>(), - cptr); - - Shiboken::Object::setValidCpp(sbkSelf, true); - Shiboken::Object::setHasCppWrapper(sbkSelf, true); - Shiboken::Object::releaseOwnership(sbkSelf); - - Shiboken::BindingManager::instance().registerWrapper(sbkSelf, cptr); - PySide::Signal::updateSourceObject(self); - cptr->metaObject(); + *cptr = new QCoreApplicationWrapper(QCoreApplicationArgCount, QCoreApplicationArgValues); + Shiboken::Object::releaseOwnership(reinterpret_cast<SbkObject*>(self)); PySide::registerCleanupFunction(&PySide::destroyQCoreApplication); Py_INCREF(self); - return 1; } |