diff options
| author | Adrian Herrmann <adrian.herrmann@qt.io> | 2024-01-31 18:12:41 +0100 |
|---|---|---|
| committer | Adrian Herrmann <adrian.herrmann@qt.io> | 2024-02-07 12:06:33 +0100 |
| commit | acab25a3ccb836818e5089b23d40196bc7414b7a (patch) | |
| tree | e705a05301240d34c0e4a9e68e753265ee5f76b8 /sources/pyside6/libpyside/pysideqslotobject_p.cpp | |
| parent | 290049e9e0066c195345afaa1ec573a1abe2f953 (diff) | |
QObject: Add connect() overload with context arg
On C++, there is an overload of QObject::connect() that allows passing a
context object. This creates a connection in the context object's event
loop instead of that of the caller. This implements said overload in
Python.
Pick-to: 6.6
Change-Id: Ia6a098a04470741efd450818c31aa5bffb1bd9f8
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Diffstat (limited to 'sources/pyside6/libpyside/pysideqslotobject_p.cpp')
| -rw-r--r-- | sources/pyside6/libpyside/pysideqslotobject_p.cpp | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/sources/pyside6/libpyside/pysideqslotobject_p.cpp b/sources/pyside6/libpyside/pysideqslotobject_p.cpp new file mode 100644 index 000000000..914be898a --- /dev/null +++ b/sources/pyside6/libpyside/pysideqslotobject_p.cpp @@ -0,0 +1,36 @@ +// Copyright (C) 2024 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#include "pysideqslotobject_p.h" + +#include <autodecref.h> +#include <gilstate.h> + +namespace PySide +{ + +void PySideQSlotObject::impl(int which, QSlotObjectBase *this_, QObject *receiver, + void **args, bool *ret) +{ + auto self = static_cast<PySideQSlotObject *>(this_); + switch (which) { + case Destroy: + delete self; + break; + case Call: + { + Shiboken::GilState state; + Shiboken::AutoDecRef arglist(PyTuple_New(0)); + Shiboken::AutoDecRef ret(PyObject_CallObject(self->callable, arglist)); + break; + } + case Compare: + case NumOperations: + Q_UNUSED(receiver); + Q_UNUSED(args); + Q_UNUSED(ret); + break; + } +} + +} // namespace PySide |
