I am wanting to have a toolbar in Qt that contains either QActions or QToolbarButtons that have popup menus attached to them. I have been able to do this perfectly in the code by creating a QMenu, adding it to a QToolbarButton and then adding that to the QToolbar. My issue is that this should be able to be done completely in designer.
This is what I have done via code, I want to define the buttons and menus in qt designer:
What we are wanting to do with qt designer is to separate the code from the interface. For example this means that one person can design the form's look and components and then a programmer can take this and code the functionality behind it. We cannot accomplish this very effectively if the toolbars and menus must be designed by the programmer.
It seems like this would be a fairly common requirement for many applications, and I can't see how Qt could have forced this to be done in code instead of designer.
If anyone has any ideas as to how this is done, maybe I'm missing something in Qt?
Toolbar support in Qt Designer seems to be a little unintuitive and limited. I don't know of any way to add popup menus with dropdown actions directly to a toolbar in Qt Designer.
You can add pushbuttons as follows. First, right-click on your main window and select "Add Toolbar", if you don't have one already. This should add a VERY SLIM toolbar at the top of your main window (slim because it's empty).
Next, add an action in the Action Editor. It's one of the panes of Qt Designer, select View->Action Editor if you don't see it. You can create new actions here.
Next, drag actions to the toolbar to populate it with pushbuttons that trigger the actions.
I know you wanted a popup menu but as far as I know, that's the extent of what you can do with Qt Designer. It seems several others have come to the same conclusion.