diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2017-10-27 14:20:36 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2017-10-27 14:20:36 +0200 |
commit | 25f899e276c00b8d7f334819d6cd7927ed67093a (patch) | |
tree | d2a063aab76e0435eb862ca5d2b541a5e718f062 /sources/pyside2/PySide2/QtGui | |
parent | 4725008aeea407ae55cfd66de802dd9e06412efc (diff) | |
parent | e30e0c161b2b4d50484314bf006e9e5e8ff6b380 (diff) |
Merge remote-tracking branch 'origin/5.6' into 5.9
Change-Id: I94cb5a7dab97cff3591bac534228bfd3e3ad5938
Diffstat (limited to 'sources/pyside2/PySide2/QtGui')
-rw-r--r-- | sources/pyside2/PySide2/QtGui/glue/qguiapplication_init.cpp | 36 | ||||
-rw-r--r-- | sources/pyside2/PySide2/QtGui/typesystem_gui_common.xml | 7 |
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&,char**,int)" access="private" /> - <add-function signature="QGuiApplication(PySequence)"> + <add-function signature="QGuiApplication(QStringList)"> <inject-code> - QGuiApplicationConstructor(%PYSELF, %1, &%0); + QGuiApplicationConstructor(%PYSELF, args, &%0); </inject-code> </add-function> <modify-function signature="exec()" rename="exec_" allow-thread="yes"/> |