Qt 和本机菜单
Qt 是否支持与 Windows 和 Linux 上的任意窗口(即 QWidget)的本机菜单栏交互?
看起来 Qt 将菜单视为放置在父窗口上的另一个子窗口小部件。也就是说,要拥有菜单栏,我必须在窗口的客户区中为其保留一些空间。这在 Mac 上毫无意义,因为菜单位于屏幕顶部。在 Windows 上,这没有什么意义 - 由系统实现的菜单位于客户区之外。不确定 Linux 上的本机模型是什么。
Does Qt support interaction with the native menu bar of an arbitrary window (i. e. QWidget) on Windows and Linux?
It looks like Qt treats the menu as just another child widget to be placed on the parent window. That is, to have a menu bar , I must reserve some space for it in the window's client area. That makes no sense on Mac, with its menu on the top of the screen. On Windows, it makes little sense - the menu, as implemented by the system, is outside of the client area. Not sure what's the native model on Linux.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Qt 支持 Mac 和 Windows 上的本机菜单。在查看 Qt Designer 中的表单时,Mac 上的 Qt 菜单似乎是非标准的,但事实并非如此。 Qt 在处理受支持平台之间的菜单差异方面做了很多工作,并且它们工作得很好。
Qt supports native menues on Mac and on Windows. It may seem when looking at the forms in Qt Designer, that Qt menues on Mac are non-standard, but they aren't. Qt had made a great deal to deal with menue differences between the supported platforms and they work very well.