QGraphicsOpacityEffect Class
The QGraphicsOpacityEffect class provides an opacity effect. 更多...
头文件: | #include <QGraphicsOpacityEffect> |
qmake: | QT += widgets |
开始支持版本: | Qt 4.6 |
基类: | QGraphicsEffect |
属性
- opacity : qreal
- opacityMask : QBrush
- 1 个属性继承自 QGraphicsEffect
- 1 个属性继承自 QObject
公有函数
QGraphicsOpacityEffect(QObject *parent = Q_NULLPTR) | |
~QGraphicsOpacityEffect() | |
qreal | opacity() const |
QBrush | opacityMask() const |
- 3 个公有函数继承自 QGraphicsEffect
- 32 个公有函数继承自 QObject
公有槽函数
void | setOpacity(qreal opacity) |
void | setOpacityMask(const QBrush &mask) |
- 2 个公有槽函数继承自 QGraphicsEffect
- 1 个公有槽函数继承自 QObject
信号
void | opacityChanged(qreal opacity) |
void | opacityMaskChanged(const QBrush &mask) |
- 1 个信号继承自 QGraphicsEffect
- 2 个信号继承自 QObject
重新实现的受保护函数
virtual void | draw(QPainter *painter) |
- 7 个受保护的函数继承自 QGraphicsEffect
- 9 个受保护的函数继承自 QObject
其他继承的成员
- 1 个公有变量继承自 QObject
- 10 个静态公有成员继承自 QObject
- 7 个受保护的函数继承自 QGraphicsEffect
- 9 个受保护的函数继承自 QObject
- 2 个受保护的变量继承自 QObject
详细描述
The QGraphicsOpacityEffect class provides an opacity effect.
An opacity effect renders the source with an opacity. This effect is useful for making the source semi-transparent, similar to a fade-in/fade-out sequence. The opacity can be modified using the setOpacity() function.
By default, the opacity is 0.7.
参见 QGraphicsDropShadowEffect, QGraphicsBlurEffect, and QGraphicsColorizeEffect.
属性
opacity : qreal
This property holds the opacity of the effect.
The value should be in the range of 0.0 to 1.0, where 0.0 is fully transparent and 1.0 is fully opaque.
By default, the opacity is 0.7.
访问函数:
qreal | opacity() const |
void | setOpacity(qreal opacity) |
Notifier signal:
void | opacityChanged(qreal opacity) |
参见 setOpacityMask().
opacityMask : QBrush
This property holds the opacity mask of the effect.
An opacity mask allows you apply opacity to portions of an element.
For example:
... QLinearGradient alphaGradient(rect.topLeft(), rect.bottomLeft()); alphaGradient.setColorAt(0.0, Qt::transparent); alphaGradient.setColorAt(0.5, Qt::black); alphaGradient.setColorAt(1.0, Qt::transparent); QGraphicsOpacityEffect *effect = new QGraphicsOpacityEffect; effect->setOpacityMask(alphaGradient); ...
There is no opacity mask by default.
访问函数:
QBrush | opacityMask() const |
void | setOpacityMask(const QBrush &mask) |
Notifier signal:
void | opacityMaskChanged(const QBrush &mask) |
参见 setOpacity().
成员函数
QGraphicsOpacityEffect::QGraphicsOpacityEffect(QObject *parent = Q_NULLPTR)
Constructs a new QGraphicsOpacityEffect instance. The parent parameter is passed to QGraphicsEffect's constructor.
QGraphicsOpacityEffect::~QGraphicsOpacityEffect()
Destroys the effect.
[virtual protected]
void QGraphicsOpacityEffect::draw(QPainter *painter)
重新实现 QGraphicsEffect::draw().
[signal]
void QGraphicsOpacityEffect::opacityChanged(qreal opacity)
This signal is emitted whenever the effect's opacity changes. The opacity parameter holds the effect's new opacity.
Note: Notifier signal for property opacity.
[signal]
void QGraphicsOpacityEffect::opacityMaskChanged(const QBrush &mask)
This signal is emitted whenever the effect's opacity mask changes. The mask parameter holds the effect's new opacity mask.
Note: Notifier signal for property opacityMask.