QML accessing unnamed signal parameters
-
Hi,
I was wondering if someone could help me.
I'm emitting signals from python using PySide2:
signal_random = QtCore.Signal(float) # ...and then ... self.signal_random.emit(1.0)
I can't find any way to send a named signal, and I'm not sure how to access the data in this signal in QML.
What I have now in QML:
Text { id: text2 x: 505 y: 357 width: 134 height: 40 text: "test" font.pixelSize: 20 Connections { target: worker onSignal_random: { text2.text="SIGNALED" } } }
This works fine, and the text changes from "test" to "SIGNALED", but I have no idea how to get at the data in the signal (and for example display it in the text field).
So I was hoping someone here could point me in the right direction. Am I missing something on naming the signal parameter in PySide2, or is there a default way to access unnamed signal parameters?
Thanks.
(I have this working if I use properties with a change notify, but I would like to get this to work as well)
-
Hi,
I was wondering if someone could help me.
I'm emitting signals from python using PySide2:
signal_random = QtCore.Signal(float) # ...and then ... self.signal_random.emit(1.0)
I can't find any way to send a named signal, and I'm not sure how to access the data in this signal in QML.
What I have now in QML:
Text { id: text2 x: 505 y: 357 width: 134 height: 40 text: "test" font.pixelSize: 20 Connections { target: worker onSignal_random: { text2.text="SIGNALED" } } }
This works fine, and the text changes from "test" to "SIGNALED", but I have no idea how to get at the data in the signal (and for example display it in the text field).
So I was hoping someone here could point me in the right direction. Am I missing something on naming the signal parameter in PySide2, or is there a default way to access unnamed signal parameters?
Thanks.
(I have this working if I use properties with a change notify, but I would like to get this to work as well)
-
That did it, thank you!