Creating a QToolbar with QT Designer

Saturday, May 22 2010

Adding the QToolbar to a QMainWindow

In QT Designer 4.62, do not look in the widget list. Instead right-click on the main window and select Add toolbar from the context menu. To add buttons to the toolbar, you must create some QActions. Select the Action Editor tab (if the tab is nowhere to be seen, go to the view menu and make sure Action Editor is checked), push the create new action button and fill the form that appears. Then drag your newly created action from the list in the action editor to the toolbar.

Adding separators

To add a separator, click on a button (QAction) you just created and select Add separator before… Do not select Append separator,  if you do, QT Designer will append a separator to the end of the toolbar, not the button. Finally, remember that toolbars can only be created on main windows (QMainWindow class).