QGraphicsOpacityEffect露

The QGraphicsOpacityEffect class provides an opacity effect. More鈥�

Inheritance diagram of PySide2.QtWidgets.QGraphicsOpacityEffect

New in version 4.6.

Synopsis露

Functions露

Slots露

Signals露

Detailed Description露

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.

../../_images/graphicseffect-opacity.png
class PySide2.QtWidgets.QGraphicsOpacityEffect([parent=None])露
param parent:

PySide2.QtCore.QObject

Constructs a new QGraphicsOpacityEffect instance. The parent parameter is passed to QGraphicsEffect 鈥榮 constructor.

PySide2.QtWidgets.QGraphicsOpacityEffect.opacity()露
Return type:

float

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.

See also

setOpacityMask()

PySide2.QtWidgets.QGraphicsOpacityEffect.opacityChanged(opacity)露
Parameters:

opacity 鈥� float

PySide2.QtWidgets.QGraphicsOpacityEffect.opacityMask()露
Return type:

PySide2.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.

See also

setOpacity()

PySide2.QtWidgets.QGraphicsOpacityEffect.opacityMaskChanged(mask)露
Parameters:

mask 鈥� PySide2.QtGui.QBrush

PySide2.QtWidgets.QGraphicsOpacityEffect.setOpacity(opacity)露
Parameters:

opacity 鈥� float

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.

See also

setOpacityMask()

PySide2.QtWidgets.QGraphicsOpacityEffect.setOpacityMask(mask)露
Parameters:

mask 鈥� PySide2.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.

See also

setOpacity()