QGraphicsBlurEffect Class
The QGraphicsBlurEffect class provides a blur effect. More...
Header: | #include <QGraphicsBlurEffect> |
CMake: | find_package(Qt6 REQUIRED COMPONENTS Widgets) target_link_libraries(mytarget PRIVATE Qt6::Widgets) |
qmake: | QT += widgets |
Inherits: | QGraphicsEffect |
Public Types
Properties
- blurHints : BlurHints
- blurRadius : qreal
Public Functions
QGraphicsBlurEffect(QObject *parent = nullptr) | |
virtual | ~QGraphicsBlurEffect() |
QGraphicsBlurEffect::BlurHints | blurHints() const |
qreal | blurRadius() const |
Reimplemented Public Functions
virtual QRectF | boundingRectFor(const QRectF &rect) const override |
Public Slots
void | setBlurHints(QGraphicsBlurEffect::BlurHints hints) |
void | setBlurRadius(qreal blurRadius) |
Signals
void | blurHintsChanged(QGraphicsBlurEffect::BlurHints hints) |
void | blurRadiusChanged(qreal radius) |
Reimplemented Protected Functions
virtual void | draw(QPainter *painter) override |
Detailed Description
A blur effect blurs the source. This effect is useful for reducing details, such as when the source loses focus and you want to draw attention to other elements. The level of detail can be modified using the setBlurRadius() function. Use setBlurHints() to choose the blur hints.
By default, the blur radius is 5 pixels. The blur radius is specified in device coordinates.
See also QGraphicsDropShadowEffect, QGraphicsColorizeEffect, and QGraphicsOpacityEffect.
Member Type Documentation
enum QGraphicsBlurEffect::BlurHint
flags QGraphicsBlurEffect::BlurHints
This enum describes the possible hints that can be used to control how blur effects are applied. The hints might not have an effect in all the paint engines.
Constant | Value | Description |
---|---|---|
QGraphicsBlurEffect::PerformanceHint | 0x00 | Indicates that rendering performance is the most important factor, at the potential cost of lower quality. |
QGraphicsBlurEffect::QualityHint | 0x01 | Indicates that rendering quality is the most important factor, at the potential cost of lower performance. |
QGraphicsBlurEffect::AnimationHint | 0x02 | Indicates that the blur radius is going to be animated, hinting that the implementation can keep a cache of blurred versions of the source. Do not use this hint if the source is going to be dynamically changing. |
The BlurHints type is a typedef for QFlags<BlurHint>. It stores an OR combination of BlurHint values.
See also blurHints() and setBlurHints().
Property Documentation
blurHints : BlurHints
This property holds the blur hint of the effect.
Use the PerformanceHint hint to say that you want a faster blur, the QualityHint hint to say that you prefer a higher quality blur, or the AnimationHint when you want to animate the blur radius.
By default, the blur hint is PerformanceHint.
Access functions:
QGraphicsBlurEffect::BlurHints | blurHints() const |
void | setBlurHints(QGraphicsBlurEffect::BlurHints hints) |
Notifier signal:
void | blurHintsChanged(QGraphicsBlurEffect::BlurHints hints) |
blurRadius : qreal
This property holds the blur radius of the effect.
Using a smaller radius results in a sharper appearance, whereas a bigger radius results in a more blurred appearance.
By default, the blur radius is 5 pixels.
The radius is given in device coordinates, meaning it is unaffected by scale.
Access functions:
qreal | blurRadius() const |
void | setBlurRadius(qreal blurRadius) |
Notifier signal:
void | blurRadiusChanged(qreal radius) |
Member Function Documentation
QGraphicsBlurEffect::QGraphicsBlurEffect(QObject *parent = nullptr)
Constructs a new QGraphicsBlurEffect instance. The parent parameter is passed to QGraphicsEffect's constructor.
[virtual]
QGraphicsBlurEffect::~QGraphicsBlurEffect()
Destroys the effect.
[signal]
void QGraphicsBlurEffect::blurHintsChanged(QGraphicsBlurEffect::BlurHints hints)
This signal is emitted whenever the effect's blur hints changes. The hints parameter holds the effect's new blur hints.
Note: Notifier signal for property blurHints.
[signal]
void QGraphicsBlurEffect::blurRadiusChanged(qreal radius)
This signal is emitted whenever the effect's blur radius changes. The radius parameter holds the effect's new blur radius.
Note: Notifier signal for property blurRadius.
[override virtual]
QRectF QGraphicsBlurEffect::boundingRectFor(const QRectF &rect) const
Reimplements: QGraphicsEffect::boundingRectFor(const QRectF &rect) const.
[override virtual protected]
void QGraphicsBlurEffect::draw(QPainter *painter)
Reimplements: QGraphicsEffect::draw(QPainter *painter).
© 2023 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.