Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. How to block signal in QML
Forum Updated to NodeBB v4.3 + New Features

How to block signal in QML

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
3 Posts 2 Posters 2.0k Views 2 Watching
  • 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.
  • P Offline
    P Offline
    PawlosCK
    wrote on last edited by
    #1

    Hi. How can I block/unblock specific signal in QML? For example "onContentYChanged".

    SeDiS 1 Reply Last reply
    -1
    • P PawlosCK

      Hi. How can I block/unblock specific signal in QML? For example "onContentYChanged".

      SeDiS Offline
      SeDiS Offline
      SeDi
      wrote on last edited by
      #2

      @PawlosCK
      It's a bit unclear to me what you want to do. If you are programatically changing contentY and you don't want a "feedback"-like reaction of your code you could define a

      property bool busy: false
      

      which you set to true while doing your thing. The method "onContentYChanged" can then be made conditional:

      onContentYChanged: {
          if (!busy) {
          }
      }
      

      HTH
      KR
      Sebastian

      1 Reply Last reply
      1
      • P Offline
        P Offline
        PawlosCK
        wrote on last edited by
        #3

        Hi. I did it and it didn't work. I mean, slot should not be executed, but I saw logs from this slot.
        I wanted to block signal at startup (and later in some cases), because function setValues adds new items at startup and this signal was invoked.
        I tried to disconnect signal from object using something like this (it's not from my code), but it didn't work too.

         mouse.clicked.disconnect(say);
         mouse.clicked.connect( function(){ console.log("22222")  });
        

        Next, I tried to use "Connections"

                Connections
                {
                    id: connection_signal_move_items
                    target: listviewID
                    function onCurrentItemChanged() { listviewID.moveItemsTouchAndMouse() }
                    enabled: false
                }
        		
        		connection_signal_move_items.enabled = false
        		connection_signal_move_items.enabled = true
        

        and it didn't work too, so I didn't know where is problem. I thought, that I did something wrong and I started this thread.

        Currently, I started use other signal and currently looks well. I have to test it more.

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved