Solved Signal boolean set checkbox qml
-
good after noon
I have a signal c++ whit emit boolean data :
emit sendPronta(p_Pronta);
I have try so:
onSendPronta: { if(p_Pronta == true){ checkBoxPronta.checked = true }else{ checkBoxPronta.checked = false } }
but not work
qrc:/Riparazioni.qml:20: ReferenceError: p_Pronta is not defined
Can how I do?
-
@Nio74 said in Signal boo lean set checkbox qml:
if(p_Pronta == true){
should not be the name of the variable you send, but the name of the parameter you specified in your signal definition.
-
the name of the parameter you specified in your signal definition.
@raven-worx is right, see this article for clarification just in case
BTW, once you have this working and let's say the parameter name is _pronta, you can simplify your code like this:
onSendPronta: { checkBoxPronta.checked = _pronta }
less lines of code -> less chances for bugs...
-
I have try bat not work:
qrc:/Riparazioni.qml:20: ReferenceError: p_Pronta is not defined
@Pablo-J.-Rogina said in Signal boo lean set checkbox qml:
the name of the parameter you specified in your signal definition.
@raven-worx is right, see this article for clarification just in case
BTW, once you have this working and let's say the parameter name is _pronta, you can simplify your code like this:
onSendPronta: { checkBoxPronta.checked = _pronta }
less lines of code -> less chances for bugs...
-
my signal is ok
-
@Nio74 you should show the definition of the signal in C++...
-
@Pablo-J.-Rogina said in Signal boo lean set checkbox qml:
@Nio74 you should show the definition of the signal in C++...
Tanks in the prototype it was declared wrong.