aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside2/PySide2/QtGui
diff options
context:
space:
mode:
Diffstat (limited to 'sources/pyside2/PySide2/QtGui')
-rw-r--r--sources/pyside2/PySide2/QtGui/glue/qguiapplication_init.cpp36
-rw-r--r--sources/pyside2/PySide2/QtGui/typesystem_gui_common.xml7
2 files changed, 10 insertions, 33 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);
}
}
diff --git a/sources/pyside2/PySide2/QtGui/typesystem_gui_common.xml b/sources/pyside2/PySide2/QtGui/typesystem_gui_common.xml
index dd8404ce0..9260b3d38 100644
--- a/sources/pyside2/PySide2/QtGui/typesystem_gui_common.xml
+++ b/sources/pyside2/PySide2/QtGui/typesystem_gui_common.xml
@@ -3238,10 +3238,7 @@
<!-- Qt5: not sure if this needs support, skipped for now -->
<rejection class="QWindow" function-name="nativeEvent"/>"
- <!-- Qt5: here the new QGuiApplication and related things -->
<object-type name="QGuiApplication">
- <!-- Qt5: gone <enum-type name="ColorSpec"/> -->
- <!-- Qt5: gone <enum-type name="Type"/> -->
<extra-includes>
<include file-name="QBasicTimer" location="global"/>
<include file-name="QFont" location="global"/>
@@ -3251,9 +3248,9 @@
<include file-name="QLocale" location="global"/>
</extra-includes>
<modify-function signature="QGuiApplication(int&amp;,char**,int)" access="private" />
- <add-function signature="QGuiApplication(PySequence)">
+ <add-function signature="QGuiApplication(QStringList)">
<inject-code>
- QGuiApplicationConstructor(%PYSELF, %1, &amp;%0);
+ QGuiApplicationConstructor(%PYSELF, args, &amp;%0);
</inject-code>
</add-function>
<modify-function signature="exec()" rename="exec_" allow-thread="yes"/>