QGraphicsOpacityEffect

Inheritance diagram of QGraphicsOpacityEffect

Note

This class was introduced in Qt 4.6

Synopsis

Functions

Slots

Signals

Detailed Description

The PySide.QtGui.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 PySide.QtGui.QGraphicsOpacityEffect.setOpacity() function.

By default, the opacity is 0.7.

../../_images/graphicseffect-opacity.png
class PySide.QtGui.QGraphicsOpacityEffect([parent=None])
Parameters:parentPySide.QtCore.QObject

Constructs a new PySide.QtGui.QGraphicsOpacityEffect instance. The parent parameter is passed to PySide.QtGui.QGraphicsEffect ‘s constructor.

PySide.QtGui.QGraphicsOpacityEffect.opacity()
Return type:PySide.QtCore.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.

PySide.QtGui.QGraphicsOpacityEffect.opacityChanged(opacity)
Parameters:opacityPySide.QtCore.qreal
PySide.QtGui.QGraphicsOpacityEffect.opacityMask()
Return type:PySide.QtGui.QBrush

This property holds the opacity mask of the effect..

An opacity mask allows you apply opacity to portions of an element.

For example:

# ...
alphaGradient = QLinearGradient(rect.topLeft(), rect.bottomLeft())
alphaGradient.setColorAt(0.0, Qt.transparent)
alphaGradient.setColorAt(0.5, Qt.black)
alphaGradient.setColorAt(1.0, Qt.transparent)
effect = QGraphicsOpacityEffect()
effect.setOpacityMask(alphaGradient)
# ...

There is no opacity mask by default.

PySide.QtGui.QGraphicsOpacityEffect.opacityMaskChanged(mask)
Parameters:maskPySide.QtGui.QBrush
PySide.QtGui.QGraphicsOpacityEffect.setOpacity(opacity)
Parameters:opacityPySide.QtCore.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.

PySide.QtGui.QGraphicsOpacityEffect.setOpacityMask(mask)
Parameters:maskPySide.QtGui.QBrush

This property holds the opacity mask of the effect..

An opacity mask allows you apply opacity to portions of an element.

For example:

# ...
alphaGradient = QLinearGradient(rect.topLeft(), rect.bottomLeft())
alphaGradient.setColorAt(0.0, Qt.transparent)
alphaGradient.setColorAt(0.5, Qt.black)
alphaGradient.setColorAt(1.0, Qt.transparent)
effect = QGraphicsOpacityEffect()
effect.setOpacityMask(alphaGradient)
# ...

There is no opacity mask by default.