Use QGraphicsSepiaEffect to Add Sepia Effect Widgets

In this post I’m sharing a class called QGraphicsSepiaEffect that you can use to add Sepia effect to your Qt Widgets. It inherits QGraphicsEffect, which means you can easily add it to your project and use a single line of code to have Sepia effect on any widget or image (i.e. on a QLabel).

sepia effect widget
QGraphicsSepiaEffect

How to Use

Download and extract QGraphicsSepiaEffect to your project folder.

Then add it to your included headers using the following line.

#include "qgraphicssepiaeffect.h"

Finally, add the following line for any widget that you want it to have Sepia effect. For example I have added Sepia effect to the progress bar shown in the picture above, using the following line:

ui->progressBar->setGraphicsEffect(new QGraphicsSepiaEffect(this));

You can download and use this class from here:

Download
QGraphicsSepiaEffect


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.