You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If defining a signal with a list or dict datatype (potentially others too?), in Qt6 it will now convert the Python object to a C++ object, then convert it back later when calling a slot, whereas in Qt5 it will return the original object. This conversion seems to be recursive.
Some effects of this:
The slot receives a copy of the object, not the original.
If you pass a custom type that inherits from list or dict, the slot will be called with a new object of the base type.
Dictionary item ordering is lost.
One fix/workaround is to define the signal with object as the datatype, which will maintain the previous behaviour.
Another quirk for the Qt6 migration section...
If defining a signal with a
list
ordict
datatype (potentially others too?), in Qt6 it will now convert the Python object to a C++ object, then convert it back later when calling a slot, whereas in Qt5 it will return the original object. This conversion seems to be recursive.Some effects of this:
list
ordict
, the slot will be called with a new object of the base type.One fix/workaround is to define the signal with
object
as the datatype, which will maintain the previous behaviour.Demo script:
With PySide5 I get the exact object returned:
With PySide6 the
Lemur
object ends up as an empty list, dictionary keys are reordered and the dictionary is a different object:The text was updated successfully, but these errors were encountered: