superqt icon indicating copy to clipboard operation
superqt copied to clipboard

Bug: signal type overrides broken on PySide6.2.1.1

Open tlambert03 opened this issue 4 years ago • 3 comments

Describe the bug haven't figured out what yet... but it's all of the failures in this test

________________________________________________________________________________
Traceback (most recent call last):
  File "/Users/talley/Dropbox (HMS)/Python/forks/superqt/src/superqt/sliders/_labeled.py", line 313, in _on_value_changed
    if len(v) != len(self._handle_labels):
TypeError: object of type 'int' has no len()

that's in the RangeSlider, where value should be a tuple... so i wonder whether class inheritance has somehow been slightly altered

tlambert03 avatar Dec 23 '21 03:12 tlambert03

ok, looks like PySide6.2 did something fundamental with signal types. It used to be possible to override the type of a signal in a subclass. for example, this worked in PySide2 and Pyside6<6.2:

class MyWidget(QSlider):
    valueChanged = Signal(tuple)  # QSlider.valueChanged is usually an int, but we could change it

# valueChanged would be a tuple

in 6.2 however, it looks like that's no longer possible. if you look at the value emitted in 6.2, even if you do mywidget.valueChanged.emit((20, 30)), the actual emitted value will be 0 :/

I created an issue here ... but I suspect this may be a "will not fix", meaning we might be stuck with some rather unfortunate breaking API changes for the range slider

tlambert03 avatar Dec 23 '21 17:12 tlambert03

Got same bug on 6.2.1.1 . 6.2.0 works.

eyalk11 avatar Jan 02 '22 11:01 eyalk11

what happens if you specify Signal(object)?

I use object workaround for Enum in PartSeg

https://github.com/4DNucleome/PartSeg/blob/4451f4ce2a5e2861d90a69c0977354b19da6b2ce/package/PartSeg/common_gui/universal_gui_part.py#L31

https://github.com/4DNucleome/PartSeg/blob/4451f4ce2a5e2861d90a69c0977354b19da6b2ce/package/PartSeg/common_gui/universal_gui_part.py#L68

At this moment I do not remember error, but it was something similar.

EDIT: I read again linked issue and it looks like my response does not fit to topic. But I left it, maybe it will be helpful for someone.

Czaki avatar Jan 03 '22 02:01 Czaki

closed by #51

tlambert03 avatar Oct 03 '22 19:10 tlambert03