aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside2/PySide2/QtCore/glue/qcoreapplication_init.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'sources/pyside2/PySide2/QtCore/glue/qcoreapplication_init.cpp')
-rw-r--r--sources/pyside2/PySide2/QtCore/glue/qcoreapplication_init.cpp31
1 files changed, 9 insertions, 22 deletions
diff --git a/sources/pyside2/PySide2/QtCore/glue/qcoreapplication_init.cpp b/sources/pyside2/PySide2/QtCore/glue/qcoreapplication_init.cpp
index c48b4ffa..b2dfae38 100644
--- a/sources/pyside2/PySide2/QtCore/glue/qcoreapplication_init.cpp
+++ b/sources/pyside2/PySide2/QtCore/glue/qcoreapplication_init.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of PySide2.
@@ -37,27 +37,14 @@
**
****************************************************************************/
-// Global variables used to store argc and argv values
-static int QCoreApplicationArgCount;
-static char** QCoreApplicationArgValues;
-
-void QCoreApplication_constructor(PyObject* self, PyObject* args, QCoreApplicationWrapper** cptr)
+static void QCoreApplicationConstructor(PyObject *self, PyObject *pyargv, QCoreApplicationWrapper **cptr)
{
- if (QCoreApplication::instance()) {
- PyErr_SetString(PyExc_RuntimeError, "A QCoreApplication instance already exists.");
- return;
- }
-
- int numArgs = PyTuple_GET_SIZE(args);
- if (numArgs != 1
- || !Shiboken::sequenceToArgcArgv(PyTuple_GET_ITEM(args, 0), &QCoreApplicationArgCount, &QCoreApplicationArgValues, "PySideApp")) {
- PyErr_BadArgument();
- return;
+ static int argc;
+ static char **argv;
+ PyObject *stringlist = PyTuple_GET_ITEM(pyargv, 0);
+ if (Shiboken::listToArgcArgv(stringlist, &argc, &argv, "PySideApp")) {
+ *cptr = new QCoreApplicationWrapper(argc, argv);
+ Shiboken::Object::releaseOwnership(reinterpret_cast<SbkObject*>(self));
+ PySide::registerCleanupFunction(&PySide::destroyQCoreApplication);
}
-
- *cptr = new QCoreApplicationWrapper(QCoreApplicationArgCount, QCoreApplicationArgValues, QT_VERSION);
-
- Shiboken::Object::releaseOwnership(reinterpret_cast<SbkObject*>(self));
- PySide::registerCleanupFunction(&PySide::destroyQCoreApplication);
- Py_INCREF(self);
}