Glade、GtkBuiler 或 Gtk 意外地交换了信号处理程序
void
add_button_clicked(GtkButton * widget, GtkTreeView * treeview){
printf("%s\n",G_OBJECT_TYPE_NAME(widget));
} // Prints GtkTreeView
虽然由于某种原因,标准 GtkButton:clicked 信号应该像这样工作(小部件本身后跟用户数据),但此处已调用交换的信号处理程序,并且两个参数混合在一起。
我可以稍微调整一下代码来解决这个问题,但我想弄清楚为什么会发生这种情况,以便我可以修复/防止它。
林间空地交换复选框未选中,并且我没有在任何地方手动连接信号,所以我不知道为什么会发生这种情况。
编辑:好吧,现在我的所有回调都发生了这种情况,这是一个巨大的巨大问题!请帮忙!
编辑:这个“功能”显然在这里,所以glade用户可以向回调添加一个glade对象并直接引用gtk函数,这样他们就可以隐藏一个小部件,而不必编写一行代码。我会跟着它一起滚动。
void
add_button_clicked(GtkButton * widget, GtkTreeView * treeview){
printf("%s\n",G_OBJECT_TYPE_NAME(widget));
} // Prints GtkTreeView
While the standard GtkButton:clicked signal is supposed to work like this (the widget itself followed by the user data) for some reason, the swapped signal handler has been called here and the two parameters are mixed up.
I could just shuffle the code around a bit to get past this but I would like to get to the bottom of why this is happening so I can fix/prevent it.
The glade swap checkbox is unchecked, and I didn't manually connect the signal anywhere, so I don't know why this is happening.
Edit: Ok, now it's happening to ALL my callbacks which is a big huge tremendous problem! Please help!
Edit: This "Feature" is apparently here so glade users can add a glade object to the callback and directly reference a gtk function so that they can for example hide a widget without having to write a single line of code. I'll roll with it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Glade 这样做是为了当您传递另一个对象时,您可以直接在其上调用标准 gtk 函数(例如关闭窗口),而无需编写任何代码。
Glade does this so that when you pass another object you can call a standard gtk function directly on it (Such as closing a window) without needing to write any code at all.