Setting up a user interface

Again, for this example, we will create a new Qt Widget Application. After that, open up mainwindow.ui and add a menu bar to the main window. Then, add the following options to the menu bar:

We have three menu items on the menu bar—File, Brush Size, and Brush Color. Under the File menu are functions for saving the canvas into a bitmap file, as well as clearing the entire canvas. The Brush Size category contains different options for the brush size; last but not least, the Brush Color category contains several options for setting the brush color.

You can go for something more paint-like or Photoshop-like for the ...

Get Hands-On GUI Programming with C++ and Qt5 now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.