[solved] javascript signals and slots
-
Having trawled through all the docs, I find myself stuck again, mainly because I know javascript, but not C++
What I have is :
1 A load of buttons, dynamically created using javascript via createComponent("whatever.qml"), and the buttons all have onclicked pointing to a function do_something
2 javascript arrays OUTSIDE the function full of stuff needed so that function do_something can make decisions.
What I am trying to learn is...
How does do_something find out what button got clicked ? (signals and slots I believe, but how in javascript ?)
How does do_something, once it has somehow learnt what button got pressed, access those javascript arrays ? This seems to be a problem due to javascript global variables not being really really global in scope.
Thanks in advance for any help. I suspect it's a situation where, once I am shown, it will all seem incredibly obvious.
-
Hi,
If I understood you correctly, you can modify the do_something() to accept an argument (eg. do_something(objname) ) and then when you call the function from that particular Button Click you can pass the Button's objectName.