views:

654

answers:

3

Is there any reason why a QMenu cannot be added from the Qt Designer? I find it weird that you can add other widget types but not this.

A: 

Adding menu editing for every widget in the designer would probably make a very awkward and inconvenient UI. There's really no place you can visualize it on.

If you're editing a QMainWindow you can edit the menu bar and its popups because there's a proper place for them to be displayed in.

shoosh
so this leaves me with the option of manually editing the .xml files?
Geo
I'm pretty sure you can't add a context menu from the XML but you can always add it with code line widget.addMenu(new QMenu()); ...
shoosh
+2  A: 

When you edit a QMainWindow you can right click the window and then choose "create menu bar".

Or are you talking about a "context menu" aka "right click menu"?

elcuco
Oh, you just had to click on that and write something. Lol.
Geo
+1  A: 

I have a single main window with a QGraphicsView and lots of QGraphicsItem objects. Each type of the Items have a different context menu.

I find that not being able to create the contextMenu's, or at least the actions that are in them a serious limitation of QtDesigner. It means that I can create about 10% or so of the actions using the designer, and I have to create 90% programaticaly. Compare that with the Microsoft resource editor which allows all of these things to be created, and maintained effortlessly.

I hope this will be addressed at some point.