- Game Programming Using Qt Beginner's Guide
- Witold Wysota Lorenz Haas
- 122字
- 2025-04-04 20:19:16
Time for action – creating a toolbar
To create a toolbar, invoke the context menu on the form and choose Add Tool Bar. Then, drag the New Game action over the toolbar and drop it there. Open a context menu for the toolbar and choose Append Separator. Then, drag the Quit action from the Action Editor and drop it in the toolbar behind the separator. The following figure presents the final layout that you should have now:

What just happened?
Creating toolbars is very similar to creating menus. You first create the container (the toolbar) and then drag-and-drop actions from the action editor. You can even drag an action from the menu bar and drop it on the toolbar and vice versa!