PyQt5 用信号槽传递list, dict是无法传递的,直接使用是会报错:
PyQt doesn't behave in the same way as Qt when it comes to passing container types between threads using signals. Specifically, there is no automatic conversion [1] to the equivalent Qt types, and therefore no implicit copying. PyQt does provide a mechanism to explicitly request such conversions, though. To do that, you can define a custom signal using either QVariantList or QVariantMap: py_sig_send_data = pyqtSignal('QVariantList') However, it's important to note that QVariantMap only supports string keys. All in all, though, it's probably simpler, clearer and safer to just explictly copy mutable python types before passing them via signals across threads.
最好的方式是将list和dict进行序列化,然后在槽函数中进行反序列化。