11from typing import List , ClassVar , TYPE_CHECKING
22
3- from PySide6 .QtCore import Signal , QObject , QMetaObject , SIGNAL , SLOT , Qt
3+ from PySide6 .QtCore import Signal , QObject , QMetaObject , SIGNAL , SLOT , Qt , __version__
44from PySide6 .QtWidgets import QScrollBar
55
66
@@ -68,13 +68,16 @@ def emitted(self) -> List[str]:
6868instance .valueChanged .emit (33 )
6969assert instance .emitted == ['my_slot_int' ]
7070
71- # disconnect
72- b = instance .valueChanged .disconnect (instance .my_slot_int )
73- assert type (b ) is bool
74- assert b
75- instance .valueChanged .emit (33 )
76- assert instance .emitted == []
71+ if __version__ < '6.8' :
72+ # disconnect
73+ b = instance .valueChanged .disconnect (instance .my_slot_int )
74+ assert type (b ) is bool
75+ # pyside 6.8.* has a bug preventing this to work properly
76+ assert b
77+ instance .valueChanged .emit (33 )
78+ assert instance .emitted == []
7779
80+ instance = SomeClassWithSignal ()
7881
7982# Connect through QObject static method, using SIGNAL + python functions
8083connection = QObject .connect (instance , SIGNAL ('valueChanged(int)' ), instance .my_slot_int , Qt .ConnectionType .DirectConnection )
@@ -83,11 +86,14 @@ def emitted(self) -> List[str]:
8386assert instance .emitted == ['my_slot_int' ]
8487
8588# disconnect
86- b = instance .valueChanged .disconnect (instance .my_slot_int )
87- assert type (b ) is bool
88- assert b
89- instance .valueChanged .emit (33 )
90- assert instance .emitted == []
89+ if __version__ < '6.8' :
90+ b = instance .valueChanged .disconnect (instance .my_slot_int )
91+ assert type (b ) is bool
92+ assert b
93+ instance .valueChanged .emit (33 )
94+ assert instance .emitted == []
95+
96+ instance = SomeClassWithSignal ()
9197
9298# Connect through QObject instance method, using SIGNAL + python functions
9399connection = instance .connect (SIGNAL ('valueChanged(int)' ), instance .my_slot_int , Qt .ConnectionType .DirectConnection )
0 commit comments