diff options
Diffstat (limited to 'examples/effects')
-rw-r--r-- | examples/effects/lighting/shadoweffect.cpp | 6 | ||||
-rw-r--r-- | examples/effects/lighting/shadoweffect.h | 1 |
2 files changed, 5 insertions, 2 deletions
diff --git a/examples/effects/lighting/shadoweffect.cpp b/examples/effects/lighting/shadoweffect.cpp index 9545815..8a41aaa 100644 --- a/examples/effects/lighting/shadoweffect.cpp +++ b/examples/effects/lighting/shadoweffect.cpp @@ -48,17 +48,19 @@ ShadowEffect::ShadowEffect(QGraphicsItem *item, QGraphicsItem *source) , item(item), m_lightSource(source) { setBlurRadius(8); + m_color = color(); } void ShadowEffect::adjustForItem() { QPointF delta = item->pos() - m_lightSource->pos(); - setShadowOffset(delta.toPoint() / 30); + setOffset(delta.toPoint() / 30); qreal dx = delta.x(); qreal dy = delta.y(); qreal dd = sqrt(dx * dx + dy * dy); - setOpacity(qBound(0.4, 1 - dd / 200.0, 0.7)); + m_color.setAlphaF(qBound(0.4, 1 - dd / 200.0, 0.7)); + setColor(m_color); } QRectF ShadowEffect::boundingRectFor(const QRectF &rect) const diff --git a/examples/effects/lighting/shadoweffect.h b/examples/effects/lighting/shadoweffect.h index b20f647..7ea409e 100644 --- a/examples/effects/lighting/shadoweffect.h +++ b/examples/effects/lighting/shadoweffect.h @@ -58,6 +58,7 @@ private: void adjustForItem(); private: + QColor m_color; QGraphicsItem *item; QGraphicsItem *m_lightSource; }; |