问题标签 [libsigc++]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
110 浏览

c++ - 为什么信号连接会使 SocketClient 对象失效?

我正在尝试通过 giomm 与 Gio 的 SocketClient 类建立 TCP / TLS 连接。

一切都很好,直到我SocketClient::event_signal ()sigc::ptr_fun ().

这是演示问题的精简示例代码:

当该connect ()方法被调用时,我得到这个控制台输出:

然后一个分段错误使程序死亡。

我已经打开 G_DEBUG=all 并在第一个错误处停止,但根据回溯,这是connect ()方法内部的某个地方。

奇怪的是,注释掉连接信号处理程序的源代码行可以解决问题。

那么在这里连接信号时我做错了什么?为什么socket客户端连接后无效?

0 投票
1 回答
248 浏览

javascript - Libsignal JavaScript 库

在我的 vue 项目中包含 libsignal JavaScript 库的最佳方法是什么。我尝试将它作为脚本添加到 main.js 文件中,但是当我在组件中使用关键字 libsignal 时,它会引发未定义的错误。

0 投票
1 回答
146 浏览

c++ - 通过访问容器的父级来使用 sigc::mem_fun

我正在尝试用 Gtkmm3 制作一个简单的软件。

我想要一个里面有网格的窗口。单击该网格内的按钮时,应触发窗口的一种方法以删除当前网格并将其替换为另一个网格。

我可以使用这样的网格方法:

“这个”是 MyGrid。

我想做这样的事情:

其中 this->get_parent() 将是 MyWindow 的一个实例

我的.h:

我的 .cpp :

0 投票
2 回答
248 浏览

c++ - 如何断开信号

我做了一个程序来计算窗口形状的面积和体积。一切正常,除了关于使用Gtk::Entry::signal_activate(). 在以下代码中:

如果我从选项案例 2 开始,一切正常。如果我通过案例 1,然后是案例 2,则按 enter 键会将焦点转移到下一个Gtk::Entry但也会启动calculation()我试图避免的功能。我认为Gtk::Entry::signal_activate()处理程序在通过案例 1 后没有断开连接,但我不知道为什么,因为我sigc::connection::disconnect()在进入案例 2 时正在调用。

我怎样才能使这项工作?

0 投票
0 回答
110 浏览

c++ - How to connect GTK+ signals (not gtkmm) to non-static class methods using libsigc++?

The goal is to connect GTK+ signals to non-static class methods using libsigc++ without gtkmm. I want to use the Glade user interface designer to design a non-trivial UI with many views, comparable to a setup wizard. The UI should be portable (Embedded Linux and Windows). So, I want to reduce the dependencies and use the C GTK+ only without the C++ language binding component gtkmm, but the UI should be written in C++. The MVC pattern should be applied to separate the responsibilities and for decoupling. As a result, my C++ views and other classes have to connect their signal handlers to the GTK+ C signals using g_signal_connect(). Later they have to use g_signal_handlers_disconnect_by_func() to disconnect the handlers. The following example demonstrates the problem:

File: GladeProgram.h

File: GladeProgram.cpp

File: Main.cpp

The test program (console program) currently runs on Windows 10 and is compiled with Visual Studio 2017.

Any help is appreciated.