如何防止菜单项响应鼠标悬停(而不使其不敏感)?
我正在向应用程序指示器添加菜单项。我不希望它们的行为像普通的菜单项:我希望它们具有正常的外观,但不响应鼠标悬停和鼠标单击。
我该如何去做呢?尝试在 gtk 到达事件之前捕获事件感觉很脆弱 - 感觉应该有更好的方法。
I'm adding menu items to an appindicator. I don't want them to behave like ordinary menu items: I want them to have normal appearance, but not to respond to mouse hovers and mouse clicks.
How do I go about doing that? Trying to grab the events before gtk gets to them feels brittle - it feels like there should be a better way.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我认为,如果您不将“激活”或“单击”事件连接到任何处理程序,菜单项将不会响应任何单击。
I think that if you don't connect the "activate" or "clicked" event to any handler, the menu items will not respond to any click.
(抱歉,没有足够的代表向 @chavaone 答案添加评论)
如答案中所述,创建菜单项,但不将其连接到任何处理程序代码。
例如,在我的 Ubuntu appindicator
indicator-lunar
中,找到此处我的菜单项主要是显示文本,单击时不执行任何操作。(sorry, not enough rep to add a comment to @chavaone answer)
As mentioned in the answer, create the menu item but just don't connect it to any handler code.
For example in my Ubuntu appindicator
indicator-lunar
, found here I have mostly menu items which are display text and do nothing when clicked.