QGraphicsBlurEffect Class

The QGraphicsBlurEffect class provides a blur effect. 更多...

头文件: #include <QGraphicsBlurEffect>
qmake: QT += widgets
开始支持版本: Qt 4.6
基类: QGraphicsEffect

公有类型

enum BlurHint { PerformanceHint, QualityHint, AnimationHint }
flags BlurHints

属性

公有函数

QGraphicsBlurEffect(QObject *parent = Q_NULLPTR)
~QGraphicsBlurEffect()
BlurHints blurHints() const
qreal blurRadius() const

重新实现的公有函数

virtual QRectF boundingRectFor(const QRectF &rect) const

公有槽函数

void setBlurHints(BlurHints hints)
void setBlurRadius(qreal blurRadius)

信号

void blurHintsChanged(BlurHints hints)
void blurRadiusChanged(qreal radius)

重新实现的受保护函数

virtual void draw(QPainter *painter)

其他继承的成员

详细描述

The QGraphicsBlurEffect class provides a blur effect.

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.

参见 QGraphicsDropShadowEffect, QGraphicsColorizeEffect, and QGraphicsOpacityEffect.

成员类型

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.

ConstantValueDescription
QGraphicsBlurEffect::PerformanceHint0x00Indicates that rendering performance is the most important factor, at the potential cost of lower quality.
QGraphicsBlurEffect::QualityHint0x01Indicates that rendering quality is the most important factor, at the potential cost of lower performance.
QGraphicsBlurEffect::AnimationHint0x02Indicates that the blur radius is going to be animated, hinting that the implementation can keep a cache of blurred verisons of the source. Do not use this hint if the source is going to be dynamically changing.

This enum was introduced or modified in Qt 4.6.

The BlurHints type is a typedef for QFlags<BlurHint>. It stores an OR combination of BlurHint values.

参见 blurHints() and setBlurHints().

属性

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.

访问函数:

BlurHints blurHints() const
void setBlurHints(BlurHints hints)

Notifier signal:

void blurHintsChanged(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.

访问函数:

qreal blurRadius() const
void setBlurRadius(qreal blurRadius)

Notifier signal:

void blurRadiusChanged(qreal radius)

成员函数

QGraphicsBlurEffect::QGraphicsBlurEffect(QObject *parent = Q_NULLPTR)

Constructs a new QGraphicsBlurEffect instance. The parent parameter is passed to QGraphicsEffect's constructor.

QGraphicsBlurEffect::~QGraphicsBlurEffect()

Destroys the effect.

[signal] void QGraphicsBlurEffect::blurHintsChanged(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.

[virtual] QRectF QGraphicsBlurEffect::boundingRectFor(const QRectF &rect) const

重新实现 QGraphicsEffect::boundingRectFor().

[virtual protected] void QGraphicsBlurEffect::draw(QPainter *painter)

重新实现 QGraphicsEffect::draw().