Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. Blocking one signal from qt

Blocking one signal from qt

Scheduled Pinned Locked Moved Solved Qt Creator and other tools
4 Posts 3 Posters 1.3k Views 1 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.
  • A Offline
    A Offline
    Amanda1102
    wrote on last edited by
    #1

    I have an object that emits lots of signals. How can I block just one signal of this object?

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      The less complex idea that comes to mind is: you can use a Boolean variable as enabler and if false don't emit the signal.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      A 1 Reply Last reply
      3
      • SGaistS SGaist

        Hi,

        The less complex idea that comes to mind is: you can use a Boolean variable as enabler and if false don't emit the signal.

        A Offline
        A Offline
        Amanda1102
        wrote on last edited by
        #3

        @SGaist Thank you. Its a good idea. I will let the topic as unsolved in case someone knows a easier way.

        1 Reply Last reply
        0
        • V Offline
          V Offline
          vmanso
          wrote on last edited by
          #4

          @Amanda1102 The options that I am aware of would be the following:

          1. QSignalBlocker: This approach will block all signals coming from a specific object
          2. disconnect: You can call "disconnect" on the specific signal you don't want for a short period of time and then call on "connect" again for the signal again.
          3. The approach mentioned by @SGaist
          1 Reply Last reply
          1

          • Login

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