menubar控件 qt_Menubars在Qt5.7中消失,Qt5.8中重现

QtQuick.Controls 2.0在Qt5.7中移除了ApplicationWindow的menuBar属性,但在Qt5.8中通过导入Qt.labs.platform 1.0重新引入。MenuBar在Ubuntu上可能显示于系统菜单而非程序窗口。建议使用ApplicationWindow的header属性结合ToolButton和Menu实现自定义菜单,以符合QtQuick.Controls 2.0的平台无关性设计。
摘要由CSDN通过智能技术生成

Menubars 在QtQuick Controls 1中存在,用来显示主窗口头部的菜单栏,但在Qt5.7的QtQuick.Controls 2.0 消失了,据说Qt5.8中会重新加入

The ApplicationWindow of Qt Quick Controls 2 doesn't have a menuBar property, it has been replaced by a more customizable header property that accepts Item (but it doesn't accept MenuBar anymore).

Qt Quick Controls 2 are not meant to offer a native desktop application, but are meant to offer simple, efficient and customizable components. For example in QQC2 you would use a ToolBaror a TabBar as the header of an ApplicationWindow.

Although it's not documented, it seems that just having a MenuBar as a child of an ApplicationWindow (in both QQC1 and QQC2) sets the native menu bar on OS X (not on Android though, and I haven't tested it on other platforms).

I asked the same question on Qt blog announcing release of Qt 5.7 and this is their answer:

http://blog.qt.io/blog/2016/06/16/qt-

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值