Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Unsolved connect and disconnect signals in js

    QML and Qt Quick
    1
    1
    349
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • ashajg
      ashajg last edited by

      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?

      1 Reply Last reply Reply Quote 0
      • First post
        Last post