Project

General

Profile

Unbinding a Signal?

Added by Tom Thorogood almost 12 years ago

Is it possible to unbind a signal after calling

x->signal().connect(this, &func);

I'm writing a class that contains a signal which bubbles upward, but I'd like to give the parent classes the option to stop listening for the bubbled signal (as if they receive the signal, they will self-destruct), in order to allow nested widget sets to be easily swapped out, as the signal also contains information about what is to replace the destroyed widgets.

If there's not a way to unbind a signal, I have a workaround in mind, but it's less elegant.

Thanks!


Replies (1)

RE: Unbinding a Signal? - Added by Wim Dumon almost 12 years ago

The .connect() call on a Wt signal returns a boost::signals::connection object. Keep this object, and call .disconnect() on it when you want to disconnect.

Wim.

    (1-1/1)