1

In PyQt5 you would do:

from PyQt5.QtCore import pyqtSignal

sumResult = pyqtSignal(int, arguments=['sum'])
sumResult.emit(42)

And then in QML:

onSumResult: console.log(sum)


Just using the PySide2 signal does not work:

from PySide2.QtCore import Signal

sumResult = Signal(int, arguments=['sum'])
sumResult.emit(42)

Error:

TypeError: 'arguments' is an invalid keyword argument for this function
Ben Hagen
  • 595
  • 6
  • 15
  • have you found an answer for this ? – ImRaphael Jun 02 '18 at 19:50
  • It is currently not possible. Watch https://bugreports.qt.io/browse/PYSIDE-634 for updates. – Ben Hagen Jun 03 '18 at 06:49
  • While I was searching for this, I found my answer in this thread: [PySide Signal argument can't be retrieved from QML](https://stackoverflow.com/a/10507528/10420332) – Stephan Oct 08 '18 at 09:46
  • @eyllanesc the question you linked is about PySide(1). This is about PySide2. Please remove the duplicate. – Ben Hagen Sep 13 '19 at 17:49
  • @BenHagen PySide2 has the same PySide problem so the answer for PySide is the same as for PySide2. Do you want someone to copy and paste the answer of the other question as an answer to this question? – eyllanesc Sep 13 '19 at 17:52
  • @eyllanesc I guess you're right. The workaround was the same too. As of Qt for Python versions 5.12.5, 5.13.1 it is now working the same as in PyQt. Added this to the other question. – Ben Hagen Sep 13 '19 at 18:02

0 Answers0