简体   繁体   English

如何使用QtDesigner将菜单栏添加到QFrame?

[英]How to add a menubar to a QFrame with QtDesigner?

I have created a QFrame with Qt designer, and now I'm trying to add a menubar. 我已经用Qt设计器创建了一个QFrame ,现在我想添加一个菜单栏。 So far I have seen that I maybe should have used QMainWindow but I can't change the type anymore and I don't see any option to attach a menu. 到目前为止,我已经看到我可能应该使用QMainWindow但是我无法再更改类型,并且看不到任何附加菜单的选项。

I have tried to create an empty QMainWindow to see how it is done there. 我试图创建一个空的QMainWindow来看看它是如何完成的。 But I can only see a menubar entry with now way how to add menus and items to it. 但是我只能看到菜单栏条目以及现在如何添加菜单和项目的方法。 Using google also didn't yield anything. 使用谷歌也没有产生任何东西。

I don't see any way to add a QMenuBar if you don't choose to create an empty QMainWindow , but if you do that, typing text into the "type here" area and pressing enter creates a new QMenu in the menu bar. 如果您不选择创建一个空的QMainWindow ,那么我看不到任何添加QMenuBar方法,但是,如果这样做,请在“此处输入”区域中键入文本,然后按Enter在菜单栏中创建一个新的QMenu There is also "type here" areas for each created menu, allowing you to add items (ie QAction s) to menus. 每个创建的菜单还有“在此处键入”区域,允许您向菜单添加项目(即QAction )。 It worked at least with QtCreator 5.3.1. 它至少与QtCreator 5.3.1兼容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM