aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside6/libpyside/qobjectconnect.cpp
Commit message (Collapse)AuthorAgeFilesLines
* libpyside: Fix parameters for connections with contextsFriedemann Kleint2024-07-041-2/+4
| | | | | | | | | | | Use the new SignalManager::callPythonMetaMethod() overload introduced by ed8fc457e04f4ead8a3b2a2da797bdc14bd5b210 in PySideQSlotObject to convert the void ** arguments to Python. Amends acab25a3ccb836818e5089b23d40196bc7414b7a. Change-Id: I024bc7f8df7fa65b8b1761f517a99a854de2cec8 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* libpyside: Fix QObject.connectNotify()Friedemann Kleint2024-07-041-2/+2
| | | | | | | | | | | | QObject::connectNotify() is meant to be called with the signal method. The code retrieved the signal method from the receiver though, potentially causing an index violation. Fix it to use the source. Remove misleading comments from 4edd9a1278efdf37f366e9aa6e82f151a357ef32. Change-Id: Id5afdde16ce002e156710128e9610804b748be74 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* libpyside: Fix static analysis warningsFriedemann Kleint2024-06-241-6/+7
| | | | | | | | | | | | | | | | - Initialize variables - Use auto * - Remove repeated return types - Fix else after return - Fix some invocations of static methods - Make functions const/static where appropriate - Fix some int types to avoid lossy conversions - Use Py_RETURN_NONE where appropriate - Minor cleanups - Remove some macros Change-Id: I7fa7a29e7b3dc47037027978001824e0709d001f Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* QObject: Add connect() overload with context argAdrian Herrmann2024-02-071-0/+43
| | | | | | | | | | | 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>
* libpyside: Port the signal signature code from QString to QByteArrayFriedemann Kleint2023-11-161-2/+2
| | | | | | | | | | Since the name ends up in QMetaObject::addSlot() taking a QByteArray anyways, there is no point in constructing the name using QString. Task-number: PYSIDE-2524 Change-Id: Ib27a55efa8b22eb983d5e27e3a981efd72e9996f Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* Fix threading deadlocks of QObject::(dis)connect() with (dis)connectNotify()Friedemann Kleint2023-10-241-2/+9
| | | | | | | | | Do the connect/disconnect within allow-threads. Fixes: PYSIDE-2367 Pick-to: 6.6 6.5 Change-Id: I95c908d438a4a6c9cd0a23d3fce31a53e02ea19d Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* Fix disconnecting non-decorated slot of base class from signalFriedemann Kleint2023-10-131-1/+2
| | | | | | | | | | | | | | | Further tighten the check for non-virtual slots overwritten in Python by checking that the QMetaObject actually returns a different declaring class. This works around the underlying issue that the logic automatically creating meta methods for non-decorated slots wrongly adds the entry to the derived class. Amends f048d13b4f042b04d94007fba951ed3080ccf8c9. Task-number: PYSIDE-2418 Fixes: PYSIDE-2487 Pick-to: 6.6 6.5 Change-Id: I0c62cfd9fd6dcb2ddf6bcfd1db14aa274293b34f Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Fix connections to base class slots falling back to global receiverFriedemann Kleint2023-08-221-4/+30
| | | | | | | | | | | | Narrow the test condition for pre-Jira bug 1019 to check whether the receiver method is not declared in the same class in which the slot returned by the MetaObject search is declared. Fixes: PYSIDE-2418 Pick-to: 6.5 Change-Id: I01591a4e948daa19caf75eaa8f803acb17b66550 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Brush up code related to pre-Jira bug 1019Friedemann Kleint2023-08-221-2/+5
| | | | | | | | | | Add explanatory comments; fix up the debug operator of GetReceiverResult. Task-number: PYSIDE-2418 Pick-to: 6.5 Change-Id: I77b9ad2d38a5bba1b78ffaf8835f20fbb93636d0 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Fix crash when mixing other decorators with @SlotFriedemann Kleint2023-05-231-0/+2
| | | | | | | Pick-to: 6.5 Task-number: PYSIDE-2338 Change-Id: Iab13d0550f59a14006e0d650270ac87a6e7fe3b3 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Fix QObject::sender() for non-C++ slotsFriedemann Kleint2022-12-121-1/+1
| | | | | | | | | | | | | | | For non-C++ slots routed via GlobalReceiverV2, sender() of the receiving QObject returns 0. To fix this, store the sender obtained in GlobalReceiverV2::qt_metacall() temporarily in a special dynamic property of the receiver and inject code checking it into QObject::sender(). This fixes at least the synchronous calls. Fixes: PYSIDE-2144 Fixes: PYSIDE-1295 Change-Id: Ia111162eb1404914ecfb7f19fadb8a1b63ae8b4a Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Use SPDX license identifiersLucie Gérard2022-05-271-38/+2
| | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Task-number: QTBUG-67283 Change-Id: I065150015bdb84a3096b5b39c061cf0a20ab637d Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* PyPySide: fix callbacks with the new "builtin method" typeChristian Tismer2022-03-171-0/+6
| | | | | | | | | | | | | | | | Using this new type, two more errors concerning callbacks could be resolved: signals::qobject_receivers_test QtWidgets::bug_860 [ChangeLog][PySide6] The new PyPy "builtin method" is now handled correctly in callback functions. Task-number: PYSIDE-1843 Task-number: PYSIDE-535 Change-Id: I0f24cf6d7c0352b853f663ffcaf899d3eb77c7e8 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* libpyside: Move helper isCompiledMethod() to pysideutils.hFriedemann Kleint2022-01-191-0/+1
| | | | | | | | | | | It appears to be a general use helper function which could be useful outside signalmanager as well. Amends 56f66f128566bd08f027fee46bb42a6c4f57a26e. Task-number: PYSIDE-1755 Change-Id: I449243bb5d800ba4d271b3079ad394810d468312 Reviewed-by: Christian Tismer <tismer@stackless.com>
* Safe distinction of Nuitka compiled methodsShyamnath Premnadh2022-01-181-2/+1
| | | | | | | | | | | | | | | | | | Adds an extra check to see if __code__ is present. As mentioned in PYSIDE-1755, Mocks are callable objects without __code__ attribute, unlike Python Method or Functions. However, a Mock also has im_func__ and im__self attributes. We made the assumption __code__ would be present if im_func and im_self are present, and this makes it fall under the category of a compiled method. This patch makes an extra check to see if __code__ is present. If it is not, then the Slot (here Mock) is considered as a callable method. Task-number: PYSIDE-1755 Pick-to: 6.2 Change-Id: If7e8f52dfb2409cd856eec0d0b41891d751d8a69 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* libpyside: Split up the pyside.h headerFriedemann Kleint2021-11-261-1/+1
| | | | | | | | | | | | | | | | Changing something in pyside.h caused excessive recompiling of all wrappers. Try to amend the situation by splitting up the header and include only what is needed. pyside.h remains as a header including the others which will be emptied out by further changes splitting out QML functionality. [ChangeLog][PySide6] The header pyside.h has been split into smaller headers. Task-number: PYSIDE-1709 Change-Id: I89ff3d9d9bc486f194ad3ec62ed372ff0be960f2 Reviewed-by: Christian Tismer <tismer@stackless.com>
* PySide6: Move QObject signal connection code into libpysideFriedemann Kleint2021-11-231-0/+284
The rather large functions should not be in code snippets. Move them into libpyside and rearrange and streamline them a bit, fixing some potential null pointer crashes as pointed out by clang checking. Change-Id: I5be6468577f2a107a286775c7e8b5874531c30fe Reviewed-by: Christian Tismer <tismer@stackless.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>