Qt not only allows us to draw shapes and images onscreen, but it also allows us to overlay multiple images on top of each other and combine the pixel information from all the layers using different types of algorithms to create very interesting results. In this example, we will learn how to overlay images on top of each other and apply different composition effects to them.
Let's create a simple demo that shows the effect of different image compositions by following these steps:
- First, set up a new Qt Widgets Application project and remove the menuBar, mainToolBar, and statusBar, as we did in the first recipe.
- Next, add the QPainter class header to the mainwindow.h file: