gtkmm中断开一个信号

其实也很简单,就是在文档中没有看到。

Easy enough:

sigc::connection c =
widget.signal_whatever().connect(sigc::mem_fun(whatever, whatever));

Then keep hold of c until you want to disconnect, and when you do, call
c.disconnect().

Works in libsigc++ 1.2 as well, with the appropriate changes:

SigC::Connection c =
widget.signal_whatever().connect(SigC::slot(whatever, whatever));

c.disconnect();

简单点说:
必须维护一个sigc::connection变量,在注销信号时必须使用原始的connection进行。

参考:
http://mail.gnome.org/archives/gtkmm-list/2004-April/msg00030.html
http://www.gtkmm.org/docs/gtkmm-2.4/docs/tutorial/html/apbs03.html


已发布

分类

来自

标签:

评论

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注