- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试通过 Glade 将 GtkEventBox 的 enter-notify-event
连接到附加的 GAction。使用 GtkInspector 检查正在运行的应用程序显示没有任何连接到 enter-notify-event
信号。
我正在关注 this blog post其中指出:
You could also set the properties via the .ui file. When you replace the event handlers of clicks with actions you can really streamline your code base.
所以我认为这在某种程度上应该是可能的。它只提到了 GtkButton 的点击处理程序,但我不明白为什么它应该与其他信号不同。
林间空地:
检查员:
<object class="GtkEventBox" id="service_row">
<property name="visible">True</property>
<property name="can_focus">False</property>
<signal name="enter-notify-event" handler="test.show-arrow" swapped="no"/>
( complete UI file )
let actions = SimpleActionGroup::new();
let show_arrow = SimpleAction::new("show-arrow", None);
actions.add_action(&show_arrow);
show_arrow.connect_activate(move |_action, _data| {
println!("enter row2");
});
row.insert_action_group("test", &actions);
// row.connect_enter_notify_event(move |_widget, _crossing| {
// actions.activate_action("show-arrow", None);
// Inhibit(false)
// });
通过推荐行中的代码手动激活 GAction 效果很好。当查看 EventBox 时,该操作也会显示在检查器中。
非常感谢任何帮助:)
最佳答案
我认为你做不到。 GtkActionable
仅针对具有明确用户激活操作的小部件实现,例如按钮或菜单项。特别是 GtkEventBox
没有实现它。
即使是这样,这个接口(interface)也只会管理每个类的一个事件,activate 操作,而不是您感兴趣的 enter-notify-event
。
因此,恐怕您将不得不继续手动连接您的事件。
关于rust - GtkEventBox 将信号连接到 Glade 中的 GAction,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54125491/
我正在开发一个 voip 调用应用程序。我需要做的是在接到来电时将 Activity 带到前台。我在应用程序中使用 Twilio,并在收到推送消息时开始调用。 问题是我试图在接到任何电话时显示 Act
我是一名优秀的程序员,十分优秀!