在PyQt5中你会这样做:
from PyQt5.QtCore import pyqtSignal
sumResult = pyqtSignal(int, arguments=['sum'])
sumResult.emit(42)
然后在QML中:
onSumResult: console.log(sum)
仅使用PySide2信号不起作用:
from PySide2.QtCore import Signal
sumResult = Signal(int, arguments=['sum'])
sumResult.emit(42)
错误:
TypeError: 'arguments' is an invalid keyword argument for this function