aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside2/PySide2/QtGui/glue/qguiapplication_init.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'sources/pyside2/PySide2/QtGui/glue/qguiapplication_init.cpp')
-rw-r--r--sources/pyside2/PySide2/QtGui/glue/qguiapplication_init.cpp36
1 files changed, 8 insertions, 28 deletions
diff --git a/sources/pyside2/PySide2/QtGui/glue/qguiapplication_init.cpp b/sources/pyside2/PySide2/QtGui/glue/qguiapplication_init.cpp
index 60507f37a..38a4c1ccb 100644
--- a/sources/pyside2/PySide2/QtGui/glue/qguiapplication_init.cpp
+++ b/sources/pyside2/PySide2/QtGui/glue/qguiapplication_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,34 +37,14 @@
**
****************************************************************************/
-// Borrowed reference to QtGui module
-extern PyObject* moduleQtGui;
-
-static int QGuiApplicationArgCount;
-static char** QGuiApplicationArgValues;
-
-bool QGuiApplicationConstructorStart(PyObject* argv)
-{
- if (QGuiApplication::instance()) {
- PyErr_SetString(PyExc_RuntimeError, "A QGuiApplication instance already exists.");
- return false;
- }
-
- return Shiboken::sequenceToArgcArgv(argv, &QGuiApplicationArgCount, &QGuiApplicationArgValues, "PySideApp");
-}
-
-void QGuiApplicationConstructorEnd(PyObject* self)
-{
- PySide::registerCleanupFunction(&PySide::destroyQCoreApplication);
- Py_INCREF(self);
-}
-
-static void QGuiApplicationConstructor(PyObject* self, PyObject* argv, QGuiApplicationWrapper** cptr)
+static void QGuiApplicationConstructor(PyObject *self, PyObject *pyargv, QGuiApplicationWrapper **cptr)
{
- if (QGuiApplicationConstructorStart(argv)) {
- // XXX do we need to support the ApplicationFlags parameter, instead of 0?
- *cptr = new QGuiApplicationWrapper(QGuiApplicationArgCount, QGuiApplicationArgValues, 0);
+ static int argc;
+ static char **argv;
+ PyObject *stringlist = PyTuple_GET_ITEM(pyargv, 0);
+ if (Shiboken::listToArgcArgv(stringlist, &argc, &argv, "PySideApp")) {
+ *cptr = new QGuiApplicationWrapper(argc, argv, 0);
Shiboken::Object::releaseOwnership(reinterpret_cast<SbkObject*>(self));
- QGuiApplicationConstructorEnd(self);
+ PySide::registerCleanupFunction(&PySide::destroyQCoreApplication);
}
}