1
1
from typing import List , ClassVar , TYPE_CHECKING
2
2
3
- from PySide6 .QtCore import Signal , QObject , QMetaObject , SIGNAL , SLOT , Qt
3
+ from PySide6 .QtCore import Signal , QObject , QMetaObject , SIGNAL , SLOT , Qt , __version__
4
4
from PySide6 .QtWidgets import QScrollBar
5
5
6
6
@@ -68,13 +68,16 @@ def emitted(self) -> List[str]:
68
68
instance .valueChanged .emit (33 )
69
69
assert instance .emitted == ['my_slot_int' ]
70
70
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 == []
77
79
80
+ instance = SomeClassWithSignal ()
78
81
79
82
# Connect through QObject static method, using SIGNAL + python functions
80
83
connection = QObject .connect (instance , SIGNAL ('valueChanged(int)' ), instance .my_slot_int , Qt .ConnectionType .DirectConnection )
@@ -83,11 +86,14 @@ def emitted(self) -> List[str]:
83
86
assert instance .emitted == ['my_slot_int' ]
84
87
85
88
# 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 ()
91
97
92
98
# Connect through QObject instance method, using SIGNAL + python functions
93
99
connection = instance .connect (SIGNAL ('valueChanged(int)' ), instance .my_slot_int , Qt .ConnectionType .DirectConnection )
0 commit comments