Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Qt Signals



  • Hi,
    I have a doubt regarding qt signals,Is it possible to block signals according to some conditions. like, I am using two signals contentSizeChanged() and loadStarted() in my program connecting to two different slots.Is it possible to make like If loadStarted()signal emitted, contentSizeChanged() signal should not work?


  • Lifetime Qt Champion

    Hi,

    Do you mean the slot connected to contentSizeChanged should do nothing ?
    If so, just use a flag that's set when the slot connected to loadStarted is called and and in the slot connected to contentSizeChanged don't do anything if the flag is set.

    Hope it helps



  • Hii...

    You can use-->bool QObject::blockSignals ( bool block )

    If block is true, signals emitted by this object are blocked (i.e., emitting a signal will not invoke anything connected to it). If block is false, no such blocking will occur.

    The return value is the previous value of signalsBlocked().


Log in to reply