CopperSpice API  1.7.2
QGraphicsOpacityEffect Class Reference

The QGraphicsOpacityEffect class provides an opacity effect. More...

Inheritance diagram for QGraphicsOpacityEffect:
QGraphicsEffect QObject

Public Signals

void opacityChanged (qreal opacity)
 
void opacityMaskChanged (const QBrush &mask)
 
- Public Signals inherited from QGraphicsEffect
void enabledChanged (bool enabled)
 
- Public Signals inherited from QObject
void destroyed (QObject *obj=nullptr)
 
void objectNameChanged (const QString &objectName)
 

Public Slots

void setOpacity (qreal opacity)
 
void setOpacityMask (const QBrush &mask)
 
- Public Slots inherited from QGraphicsEffect
void setEnabled (bool enable)
 
void update ()
 
- Public Slots inherited from QObject
void deleteLater ()
 

Public Methods

 QGraphicsOpacityEffect (QObject *parent=nullptr)
 
 ~QGraphicsOpacityEffect ()
 
qreal opacity () const
 
QBrush opacityMask () const
 
- Public Methods inherited from QGraphicsEffect
 QGraphicsEffect (QObject *parent=nullptr)
 
virtual ~QGraphicsEffect ()
 
QRectF boundingRect () const
 
virtual QRectF boundingRectFor (const QRectF &rectF) const
 
bool isEnabled () const
 
- Public Methods inherited from QObject
 QObject (QObject *parent=nullptr)
 
 ~QObject ()
 
bool blockSignals (bool block)
 
const QList< QObject * > & children () const
 
bool connect (const QObject *sender, const QString &signalMethod, const QString &location, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection)
 
bool connect (const QObject *sender, const QString &signalMethod, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection)
 
bool disconnect (const QObject *receiver, const QString &slotMethod=QString ()) const
 
bool disconnect (const QString &signalMethod, const QString &location, const QObject *receiver=nullptr, const QString &slotMethod=QString ()) const
 
bool disconnect (const QString &signalMethod=QString (), const QObject *receiver=nullptr, const QString &slotMethod=QString ()) const
 
void dumpObjectInfo ()
 
void dumpObjectTree ()
 
QList< QStringdynamicPropertyNames () const
 
virtual bool event (QEvent *event)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
template<typename T >
findChild (const QString &childName=QString ()) const
 
template<class T >
QList< T > findChildren (const QRegularExpression &regExp, Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 
template<class T >
QList< T > findChildren (const QString &objName=QString (), Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 
bool inherits (const QString &className) const
 
void installEventFilter (QObject *filterObj)
 
bool isWidgetType () const
 
bool isWindowType () const
 
void killTimer (int id)
 
const QMetaObjectmetaObject () const
 
void moveToThread (QThread *targetThread)
 
QString objectName () const
 
QObject * parent () const
 
template<class T = QVariant>
property (const QString &name) const
 
void removeEventFilter (QObject *obj)
 
void setObjectName (const QString &name)
 
void setParent (QObject *parent)
 
bool setProperty (const QString &name, const QVariant &value)
 
bool signalsBlocked () const
 
int startTimer (int interval, Qt::TimerType timerType=Qt::CoarseTimer)
 
QThreadthread () const
 

Protected Methods

void draw (QPainter *painter) override
 
- Protected Methods inherited from QGraphicsEffect
void drawSource (QPainter *painter)
 
QRectF sourceBoundingRect (Qt::CoordinateSystem system=Qt::LogicalCoordinates) const
 
virtual void sourceChanged (ChangeFlags flags)
 
bool sourceIsPixmap () const
 
QPixmap sourcePixmap (Qt::CoordinateSystem system=Qt::LogicalCoordinates, QPoint *offset=nullptr, PixmapPadMode mode=PadToEffectiveBoundingRect) const
 
void updateBoundingRect ()
 
- Protected Methods inherited from QObject
virtual void childEvent (QChildEvent *event)
 
virtual void connectNotify (const QMetaMethod &signalMethod) const
 
virtual void customEvent (QEvent *event)
 
virtual void disconnectNotify (const QMetaMethod &signalMethod) const
 
bool isSignalConnected (const QMetaMethod &signalMethod) const
 
int receivers (const QString &signal) const
 
QObject * sender () const
 
int senderSignalIndex () const
 
virtual void timerEvent (QTimerEvent *event)
 

Properties

 opacity
 
 opacityMask
 
- Properties inherited from QGraphicsEffect
 enabled
 
- Properties inherited from QObject
 objectName
 

Additional Inherited Members

- Public Types inherited from QGraphicsEffect
enum  PixmapPadMode
 
- Static Public Methods inherited from QObject
static bool connect (const QObject *sender, const QMetaMethod &signalMethod, const QObject *receiver, const QMetaMethod &slotMethod, Qt::ConnectionType type=Qt::AutoConnection)
 
static bool connect (const QObject *sender, const QString &signalMethod, const QObject *receiver, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection, const QString &location=QString ())
 
static bool connect (const QObject *sender, const QString &signalMethod, const QString &location, const QObject *receiver, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection)
 
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class SlotClass , class... SlotArgs, class SlotReturn >
static bool connect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, SlotReturn (SlotClass::*slotMethod)(SlotArgs...), Qt::ConnectionType type=Qt::AutoConnection)
 
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class T >
static bool connect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, T slotLambda, Qt::ConnectionType type=Qt::AutoConnection)
 
static bool disconnect (const QObject *sender, const QMetaMethod &signalMethod, const QObject *receiver, const QMetaMethod &slotMethod)
 
static bool disconnect (const QObject *sender, const QString &signalMethod, const QObject *receiver, const QString &slotMethod)
 
static bool disconnect (const QObject *sender, const QString &signalMethod, const QString &location, const QObject *receiver, const QString &slotMethod)
 
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class SlotClass , class... SlotArgs, class SlotReturn >
static bool disconnect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, SlotReturn (SlotClass::*slotMethod)(SlotArgs...))
 
template<class Sender , class SignalClass , class... SignalArgs, class Receiver >
static bool disconnect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, std::nullptr_t slotMethod=nullptr)
 
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class T >
static bool disconnect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, T slotMethod)
 
static QMetaObjectstaticMetaObject ()
 
static QString tr (const char *text, const char *comment=nullptr, std::optional< int > numArg=std::optional< int >())
 

Detailed Description

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.

See also
QGraphicsDropShadowEffect, QGraphicsBlurEffect, QGraphicsColorizeEffect

Constructor & Destructor Documentation

QGraphicsOpacityEffect::QGraphicsOpacityEffect ( QObject parent = nullptr)

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

QGraphicsOpacityEffect::~QGraphicsOpacityEffect ( )

Destroys the effect.

Method Documentation

void QGraphicsOpacityEffect::draw ( QPainter painter)
overrideprotectedvirtual

Reimplemented from QGraphicsEffect::draw().

Implements QGraphicsEffect.

qreal QGraphicsOpacityEffect::opacity ( ) const

Property documentation pending.

void QGraphicsOpacityEffect::opacityChanged ( qreal  opacity)
signal

This signal is emitted whenever the effect's opacity changes. The opacity parameter holds the effect's new opacity.

QBrush QGraphicsOpacityEffect::opacityMask ( ) const

Property documentation pending.

void QGraphicsOpacityEffect::opacityMaskChanged ( const QBrush mask)
signal

This signal is emitted whenever the effect's opacity mask changes. The mask parameter holds the effect's new opacity mask.

void QGraphicsOpacityEffect::setOpacity ( qreal  opacity)
slot

Property documentation pending.

void QGraphicsOpacityEffect::setOpacityMask ( const QBrush mask)
slot

Property documentation pending.

Property Documentation

QGraphicsOpacityEffect::opacity

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()
PropertiesClass Methods
read opacity
write setOpacity
notify opacityChanged
QGraphicsOpacityEffect::opacityMask

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);
effect->setOpacityMask(alphaGradient);
...

There is no opacity mask by default.

See also
setOpacity()
PropertiesClass Methods
read opacityMask
write setOpacityMask
notify opacityMaskChanged