connect and disconnect signals in js
Unsolved
QML and Qt Quick
-
Hi guys
I am trying to connect and disconnect signals of qml in .js.
In this function I am creating objects of qml and establishing connection by writing this line
mainrow.children[1].tvclicked.connect(onTvclicked);
function finishComponentCreation() {var groupLength=4; console.log("inside finishcomp") compcreate=comp.createObject(parentID,{"iCompID":0}) tvfourCreation=buttons.createObject(mainrow,{"iCompID":1,"strText":"TV","value":100}) mainrow.children[1].tvclicked.connect(onTvclicked); ///**connect** fourCreation=buttons.createObject(mainrow,{"iCompID":2,"strText":"RR","value":100}) fourCreation=buttons.createObject(mainrow,{"iCompID":3,"strText":"I:E","value":100}) fourCreation=buttons.createObject(mainrow,{"iCompID":4,"strText":"PEEP","value":100}) moreSetCrt=moreSetting.createObject(mainrow,{"iCompID":5}) }
However I want to disconnect connection on certain event so I wrote another function
function changes(mode) { console.log("changes--->"+mode) if(mode==="PCV") {console.log("########################") mainrow.children[1]. tvclicked.disconnect(onTvclicked) // here i am trying to disconnect that connection mainrow.children[1]. tvclicked.connect(onRRclicked)// new connection conected to different function } }
but I am unable to disconnect ...this is not working mainrow.children[1]. tvclicked.disconnect(onTvclicked)
why it is not getting disconnected?