The Qt Graphical Effects module is provided for compatibility with applications written for Qt 5.
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 20 effects provided as separate QML types. The effects cover functional areas such as masking, blurring, coloring, and many more.
要加载 Qt Graphical Effects,添加以下 import 语句到 .qml 文件:
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.
注意:
Effects are not available when running with the
software
backend of Qt Quick. For more information on Qt Quick scene graph backends, see
场景图形适配
.
注意: Runtime-generated effects such as GaussianBlur will store the shader-files in temporary storage using QTemporaryFile , thus they require a writable file system.
通过使用融合方式合并 2 源项 | |
Adjusts brightness and contrast | |
Alters the colors of the source item by applying an overlay color | |
Sets the color in the HSL color space | |
绘制锥形渐变 | |
Reduces the saturation of the colors | |
把模糊效果应用到指定方向 | |
Moves the pixels of the source item according to the given displacement map | |
Generates a soft shadow behind the source item | |
Applies a fast blur effect to one or more source items | |
Alters the luminance of the source item | |
应用更高质量的模糊效果 | |
Generates a blurred and colorized image of the source and places it behind the original, giving impression that the source is glowing | |
Alters the source item colors in the HSL color space | |
Generates a colorized and blurred shadow inside the source | |
Adjusts color levels in the RGBA color space | |
绘制线性渐变 | |
Applies a blur effect with a varying intesity | |
Masks the source item with another item | |
Applies directional blur in a circular direction around the items center point | |
绘制径向渐变 | |
Generates a blurred and colorized rectangle, which gives the impression that the source is glowing | |
Blurs repeatedly, providing a strong blur effect | |
Masks the source item with another item and applies a threshold value | |
Applies directional blur effect towards source items center point |