aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside6/tests/QtCore
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2023-05-17 15:48:39 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2023-05-22 14:54:05 +0200
commit64bacdf74cc7a32cd5bd60ed50bf5cbe998483ff (patch)
tree25491638c9c9f699d167334571d9b10f59c822ec /sources/pyside6/tests/QtCore
parent639d8096fefa317a3d60c79f70a620f31674c644 (diff)
PySide6: Fix connecting signals with arguments by constructor kwargs
The search was only implemented for signals without arguments by appending "()" to the signal name to form the search signature. Implement a search by signal name only. Fixes: PYSIDE-2329 Pick-to: 6.5 Change-Id: I295150cdebe60c886891553c9f31d14011a004d6 Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Diffstat (limited to 'sources/pyside6/tests/QtCore')
-rw-r--r--sources/pyside6/tests/QtCore/signal_sender.py30
1 files changed, 29 insertions, 1 deletions
diff --git a/sources/pyside6/tests/QtCore/signal_sender.py b/sources/pyside6/tests/QtCore/signal_sender.py
index c85dc6da9..2552591e5 100644
--- a/sources/pyside6/tests/QtCore/signal_sender.py
+++ b/sources/pyside6/tests/QtCore/signal_sender.py
@@ -12,7 +12,8 @@ init_test_paths(False)
from helper.usesqapplication import UsesQApplication
-from PySide6.QtCore import QCoreApplication, QObject, QTimer, Signal, Slot
+from PySide6.QtCore import (QCoreApplication, QObject, QStringListModel,
+ QTimer, Signal, Slot, Qt)
class Sender(QObject):
@@ -59,5 +60,32 @@ class TestSignalSender(UsesQApplication):
self.assertEqual(derived_receiver._sender, sender)
+class TestConstructorConnection(UsesQApplication):
+ """PYSIDE-2329: Check constructor connections for signals from the
+ base as well as signals with arguments."""
+ def testConstructorConnection(self):
+
+ was_destroyed = False
+ was_changed = False
+
+ def destroyed_handler():
+ nonlocal was_destroyed
+ was_destroyed = True
+
+ def changed_handler():
+ nonlocal was_changed
+ was_changed = True
+
+ data_list = ["blub"]
+ model = QStringListModel(data_list,
+ destroyed=destroyed_handler,
+ dataChanged=changed_handler)
+ model.setData(model.index(0, 0), "bla", Qt.EditRole)
+ del model
+
+ self.assertTrue(was_changed)
+ self.assertTrue(was_destroyed)
+
+
if __name__ == '__main__':
unittest.main()