How can I insert a function in a switch case?
-
I have a signal in my backend file (main.py) to send random values in variable "temped":
temped = randint(35,40)
[...]
setTempED = Signal(str)
[...]
self.setTempED.emit(str(temped))And I have a .qml file with:
property real temped Connections { target: backend function onSetTempED(temp2) { temped = temp2 } }
(In this variable, I receive the random value of setTempED)
[...]
Component.onCompleted: { selectparameter_Q1.okclicked1.connect(function(id){ switch(id) { case 0: monitorscreen.tq1.text = "Temp Óleo Freio (ED)" monitorscreen.q1.text = temped monitorscreen.q5.text = "°C" break [...]
The signal "okclicked1(var id)" is in another .QML file, and It sends a signal to insert this value in an alias property
My problem is, when I send the signal okclicked(), the field monitorscreen.q1.text receives the actual value of function, but doesn't update in real time, it stays fixed. I need that this variable been dynamic according to values generate by function.
Here's a video to ilustrate the problem: https://drive.google.com/file/d/1iN6sSbb1Vy2N1TQg9aIurFLUhaJdE4iv/view?usp=sharing