Qt 5 Compatibility APIs: Graphical Effects

The Qt Graphical Effects module is provided for compatibility with applications written for Qt 5. As far as practically feasible, effects have been ported, but some dynamically generated effects are incompatible with the approach to shader effects in Qt 6 and have thus been left out.

The Qt Graphical Effects module provides a set of QML types for adding visually impressive and configurable effects to user interfaces. Effects are visual items that can be added to Qt Quick user interface as UI components.

The API consists of over 15 effects provided as separate QML types. The effects cover functional areas such as masking, blurring, coloring, and many more.

Getting Started

To load Qt Graphical Effects, add the following import statement to your .qml file:

import Qt5Compat.GraphicalEffects

To use the effects, simply add a specific effect declaration to the QML scene and configure the effects properties. Effects have one or more source properties for specifying the visual input for which the effect is applied to. The altered visual output is then presented in the effect item itself. The source can be another, often hidden, item in the QML scene. More complex effects can have multiple sources. The source item type can be any QML type, even video or another effect. Pipelining multiple effects together is a simple way to create even more impressive output.

Each effect has a set of properties that can be used to configure the effect output. Properties can be animated just like any other QML properties. The QML type documentation contains property descriptions and basic usage examples.

Note: Effects are not available when running with the software backend of Qt Quick. For more information on Qt Quick scene graph backends, see Scene Graph Adaptations.

QML Types

BrightnessContrast

Adjusts brightness and contrast

ColorOverlay

Alters the colors of the source item by applying an overlay color

Colorize

Sets the color in the HSL color space

ConicalGradient

Draws a conical gradient

Desaturate

Reduces the saturation of the colors

Displace

Moves the pixels of the source item according to the given displacement map

DropShadow

Generates a colorized and blurred shadow image of the source and places it behind the original, giving the impression that source item is raised from the background

FastBlur

Applies a fast blur effect to one or more source items

GammaAdjust

Alters the luminance of the source item

Glow

Generates a blurred and colorized image of the source and places it behind the original, giving impression that the source is glowing

HueSaturation

Alters the source item colors in the HSL color space

LevelAdjust

Adjusts color levels in the RGBA color space

LinearGradient

Draws a linear gradient

OpacityMask

Masks the source item with another item

RadialGradient

Draws a radial gradient

RectangularGlow

Generates a blurred and colorized rectangle, which gives the impression that the source is glowing

ThresholdMask

Masks the source item with another item and applies a threshold value

Reference

© 2024 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.