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

This entry was posted in Program and tagged , , . Bookmark the permalink.

发表评论

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

*

您可以使用这些 HTML 标签和属性: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Please copy the string EIdozU to the field below:

以新浪微博帐号登录