Applying image effects to graphics

Qt provides an easy way to add image effects to any graphics drawn using the QPainter class. In this example, we will learn how to apply different images effects, such as drop shadow, blur, colorize, and opacity effects, to a graphic before displaying it on screen.

How to do it…

Let's learn how to apply image effects to text and graphics by following these steps:

  1. Create a new Qt Widgets Application and remove the menu bar, tool bar, and status bar.
  2. Create a new resource file by going to File | New File or Project and adding all the images required by the project:
    How to do it…
  3. Next, open up mainwindow.ui and add four labels to the ...

Get Qt5 C++ GUI Programming Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.