diff options
author | Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> | 2018-05-07 14:08:09 +0200 |
---|---|---|
committer | Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> | 2018-05-15 09:55:58 +0000 |
commit | a1d13bfe47c5b2b7ca2c915dca0094c1f8448deb (patch) | |
tree | ad31f7902fabf967d0ff36c0058869bba2b751be /sources/pyside2/PySide2 | |
parent | e27cde95bc353b2f34ba3ef86a62c38b7231b6a4 (diff) |
Add default parameter to Q*Applications
When no arguments are passed, build an empty list
and to start a QCoreApplication, QApplication and
QGuiApplication.
This is a small effort to include the idea
of a default parameter from Python.
Change-Id: Ieedc1e7ee17de996778aa2d0bddfb88c5ef208cf
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'sources/pyside2/PySide2')
3 files changed, 24 insertions, 0 deletions
diff --git a/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml b/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml index b0c4da4ee..f0b6b9640 100644 --- a/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml +++ b/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml @@ -3259,6 +3259,14 @@ QCoreApplicationConstructor(%PYSELF, args, &%0); </inject-code> </add-function> + <add-function signature="QCoreApplication()"> + <inject-code> + PyObject *empty = PyTuple_New(2); + if (!PyTuple_SetItem(empty, 0, PyList_New(0))) { + QCoreApplicationConstructor(%PYSELF, empty, &%0); + } + </inject-code> + </add-function> <!-- blocking functions --> <modify-function signature="processEvents(QFlags<QEventLoop::ProcessEventsFlag>,int)" allow-thread="yes"/> <modify-function signature="processEvents(QFlags<QEventLoop::ProcessEventsFlag>)" allow-thread="yes"/> diff --git a/sources/pyside2/PySide2/QtGui/typesystem_gui_common.xml b/sources/pyside2/PySide2/QtGui/typesystem_gui_common.xml index a9815cf67..6d69f6b4c 100644 --- a/sources/pyside2/PySide2/QtGui/typesystem_gui_common.xml +++ b/sources/pyside2/PySide2/QtGui/typesystem_gui_common.xml @@ -3286,6 +3286,14 @@ QGuiApplicationConstructor(%PYSELF, args, &%0); </inject-code> </add-function> + <add-function signature="QGuiApplication()"> + <inject-code> + PyObject *empty = PyTuple_New(2); + if (!PyTuple_SetItem(empty, 0, PyList_New(0))) { + QGuiApplicationConstructor(%PYSELF, empty, &%0); + } + </inject-code> + </add-function> <modify-function signature="exec()" rename="exec_" allow-thread="yes"/> <inject-code class="native" file="glue/qguiapplication_init.cpp" position="beginning" /> diff --git a/sources/pyside2/PySide2/QtWidgets/typesystem_widgets_common.xml b/sources/pyside2/PySide2/QtWidgets/typesystem_widgets_common.xml index 52b1c41d5..b4a6c2453 100644 --- a/sources/pyside2/PySide2/QtWidgets/typesystem_widgets_common.xml +++ b/sources/pyside2/PySide2/QtWidgets/typesystem_widgets_common.xml @@ -3201,6 +3201,14 @@ QApplicationConstructor(%PYSELF, args, &%0); </inject-code> </add-function> + <add-function signature="QApplication()"> + <inject-code> + PyObject *empty = PyTuple_New(2); + if (!PyTuple_SetItem(empty, 0, PyList_New(0))) { + QApplicationConstructor(%PYSELF, empty, &%0); + } + </inject-code> + </add-function> <modify-function signature="exec()" rename="exec_" allow-thread="yes"/> <inject-code class="native" file="glue/qapplication_init.cpp" position="beginning" /> </object-type> |