简体   繁体   English

GTKmm为什么signal_hide()信号不能正确发出?

[英]GTKmm Why the signal_hide() signal doesn't emit correctly?

I've got a Gtk::Box container (maincontroller) and inside of it, there is a Gtk::Grid (mainmenu). 我有一个Gtk :: Box容器(maincontroller),在它的内部,有一个Gtk :: Grid(mainmenu)。 I've added a signal in the maincontroller.cpp like this: 我在maincontroller.cpp中添加了一个信号,如下所示:

mainmenu->signal_hide().connect(
        sigc::mem_fun(this, &MainController::Elmozdulas)
        );

When i press a button in the mainmenu, i call the hide() function, what works correctly, i don't see anything after that, but it doesn't emit the signal, only if i close the window. 当我按下主菜单中的按钮时,我调用hide()函数,该函数可以正常工作,此后我什么也看不到,但是只有当我关闭窗口时,它才发出信号。 Why is that and how could i fix it? 为什么会这样,我该如何解决?

Thanks for your answers in advance! 预先感谢您的回答!

You might consider binding to signal_unmap instead. 您可以考虑绑定到signal_unmap I think signal_hide only gets called if the widget is hidden, not if one of its parents are. 我认为signal_hide仅在隐藏了小部件时调用,而不是在其父级之一被隐藏时调用。 Neither of these would be triggered if hide is actually called on a child of mainmenu rather than mainmenu itself. 如果实际上在mainmenu的子菜单而不是mainmenu本身的子菜单上调用hide,则不会触发这两种方法。 In that case it would appear like mainmenu had been hidden, but would in fact still be visible (and mapped, and realized). 在这种情况下,似乎mainmenu已被隐藏,但实际上仍然可见(并映射和实现)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM